3 ms·
> each is in its own OS thread and GVL releases when the thread blocks. The GVL isn't automatically released when a thread blocks on IO. Each bit of native cod
by jashmatthews 6y ago
> each is in its own OS thread and GVL releases when the thread blocks.
The GVL isn't automatically released when a thread blocks on IO. Each bit of native code performing IO has to explicitly release it like in the pg gem here: https://github.com/ged/ruby-pg/blob/fb465855ce1dd12cf7eb69c92af222052aa956ce/ext/gvl_wrappers.h#L4 https://github.com/ged/ruby-pg/blob/fb465855ce1dd12cf7eb69c9...
If you don't need high concurrency then using threads is simpler.