Skip to content

Commit acedfd2

Browse files
committed
Avoid thread blocking on Ruby 1.9.x under Windows. Closes #142
1 parent 3ef4853 commit acedfd2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## In Git
4+
* Avoid thread blocking on Ruby 1.9.x under Windows. Patch by Roger Pack.
5+
36
## 0.3.2 (April 26th, 2011)
47
* Fix typo in initialization for older ActiveRecord versions
58

ext/mysql2/client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ static VALUE rb_mysql_client_query(int argc, VALUE * argv, VALUE self) {
380380
for(;;) {
381381
int fd_set_fd = fd;
382382

383-
#ifdef _WIN32
383+
#if defined(_WIN32) && !defined(HAVE_RB_THREAD_BLOCKING_REGION)
384384
WSAPROTOCOL_INFO wsa_pi;
385385
// dupicate the SOCKET from libmysql
386386
int r = WSADuplicateSocket(fd, GetCurrentProcessId(), &wsa_pi);
@@ -394,7 +394,7 @@ static VALUE rb_mysql_client_query(int argc, VALUE * argv, VALUE self) {
394394

395395
retval = rb_thread_select(fd_set_fd + 1, &fdset, NULL, NULL, tvp);
396396

397-
#ifdef _WIN32
397+
#if defined(_WIN32) && !defined(HAVE_RB_THREAD_BLOCKING_REGION)
398398
// cleanup the CRT fd
399399
_close(fd_set_fd);
400400
// cleanup the duplicated SOCKET

0 commit comments

Comments
 (0)