This can help us notice real bugs in our code sooner.
Some of the unused variable warnings are pedantic from our usage
of -Wextra, but GCC >= 3 provides us with a handy attribute we
can use to mark variables unused. -Wextra is also a default
flag for 1.9.2dev, so we might as well get used to it.
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.