Project

General

Profile

Actions

Feature #5543

closed

rb_thread_blocking_region() API is poorly designed

Added by cjameshuff (Christopher Huff) about 13 years ago. Updated over 12 years ago.

Status:
Closed
Target version:
[ruby-core:40648]

Description

First, rb_thread_blocking_region() requires the blocking code to be pulled out into a separate function, scattering code through the source file and giving the coder more work to do to pass information through to that function. Something like rb_thread_blocking_region_begin() and rb_thread_blocking_region_end(), or the BLOCKING_REGION macro used to implement rb_thread_blocking_region(), would be far more convenient to use, but were apparently deprecated and are now only usable within thread.c.

Worse, the function passed to rb_thread_blocking_region() must return a Ruby VALUE, but also must execute without a VM lock. It is rather nonsensical to specify that a function return a Ruby object while forbidding it from accessing most of Ruby. It is likely the function won't touch the anything related to Ruby at all, and while you can use casting to work around it, you shouldn't have to. The main result of all this is less readable and even somewhat misleading code.


Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #4328: export rb_thread_call_with_gvl()Closedko1 (Koichi Sasada)01/27/2011Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0