There are still some corner-case calls which may cause
network activity and block the socket, but the majority
of reads/writes on the socket will release the GVL under
1.9 and be signal-safe under all versions of Ruby.
We'll also make a note of all functions calls that passed
visual inspection and add FIXME for a few more corner
cases we still need to fix.
mysql_real_connect() is a blocking function that issues
blocking-but-interruptible connect(), read(), and write() system
calls. So we'll allow other threads in the VM to run while
calling it since it can block indefinitely.
This introduces a rb_thread_blocking_region() wrapper for 1.8
which ensures any received signals can be handled gracefully
while inside blocking function calls.
This allows the caller to iterate over the Mysql2::Result instance as many times as they want, lazily pulling what rows are needed from the mysql C result.