# Glib2: rb\_thread\_blocking\_region removed from Ruby

**URL:** <https://www.ruby-forum.com/t/glib2-rb-thread-blocking-region-removed-from-ruby/239687>\
**Category:** Ruby-Gnome 2\
**Created:** [March 10, 2014, 5:15pm UTC](https://www.ruby-forum.com/t/glib2-rb-thread-blocking-region-removed-from-ruby/239687 "2014-03-10T17:15:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [March 10, 2014, 5:15pm UTC](https://www.ruby-forum.com/t/glib2-rb-thread-blocking-region-removed-from-ruby/239687/1 "2014-03-10T17:15:15Z")

</div>

Dear Kou and other readers:

today I compiled ruby-gnome2 from git using ruby from svn, and I  
encountered a snag.

It appears that function rb\_thread\_blocking\_region, that was  
deprecated, has been eventually removed for good. This function is  
only used once in rbglib\_maincontext.c.

Substituting it is easy, from what I read: include \<ruby/thread.h\> and  
then call rb\_thread\_call\_without\_gvl instead of  
rb\_thread\_blocking\_region, with exactly the same parameters.

But there is a problem. Usage of rb\_thread\_blocking\_region is governed  
by a macro (HAVE\_RB\_THREAD\_BLOCKING\_REGION) that’s defined during  
configuration, and if the function is not found, some code which is I  
believe older than the insertion of that function is compiled in - see  
lines 24-32 of rbglib\_maincontext.c. I believe this is old stuff  
because there is no way to include version.h like it is done there.

I was able to complete the compilation by:

1. adding a

#define HAVE\_RB\_THREAD\_BLOCKING\_REGION

before #ifdef HAVE\_RB\_THREAD\_BLOCKING\_REGION in rgbprivate.h,

1. adding a

#include \<ruby/thread.h\>

after including rgbprivate.h, in rbglib\_maincontext.c, and

1. substituting

with

```
rb_thread_call_without_gvl(rg_poll_in_blocking, &info, RUBY_UBF_IO, 

```

NULL);

around line 95 in rbglib\_maincontext.c.

Of course it’s an ugly hack. I am sure you will concoct the correct  
magic, though.

Carlo

–

- 

```
    Se la Strada e la sua Virtu' non fossero state messe da 

```

parte,

- K \* Carlo E. Prelz - removed\_email\_address@domain.invalid che bisogno ci  
sarebbe
  - 

```
          di parlare tanto di amore e di rettitudine? 

```

(Chuang-Tzu)

---

<div class="post-metadata">

**Author:** ![Carlo\_ESPrelz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f07891/32.png) [@Carlo\_ESPrelz](https://www.ruby-forum.com/u/Carlo_ESPrelz)\
**Post date:** [March 11, 2014, 2:10pm UTC](https://www.ruby-forum.com/t/glib2-rb-thread-blocking-region-removed-from-ruby/239687/2 "2014-03-11T14:10:34Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“[ruby-gnome2-devel-en] glib2: rb\_thread\_blocking\_region removed from  
Ruby” on Mon, 10 Mar 2014 16:57:31 +0100,  
“Carlo E. Prelz” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> today I compiled ruby-gnome2 from git using ruby from svn, and I  
> encountered a snag.

It is strange. I committed changes that support Ruby trunk a  
few days ago.

Oh… I forgot to push the commit…  
It didn’t included in Ruby-GNOME2 2.2.0…

I’ve pushed it now:  
[glib2: support Ruby head · ruby-gnome/ruby-gnome@c92a046 · GitHub](https://github.com/ruby-gnome2/ruby-gnome2/commit/c92a046cfe266cedbd59a40b31cfc9ea6e8ab300)

It was my mistake. Sorry…

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![Carlo\_ESPrelz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f07891/32.png) [@Carlo\_ESPrelz](https://www.ruby-forum.com/u/Carlo_ESPrelz)\
**Post date:** [March 11, 2014, 2:14pm UTC](https://www.ruby-forum.com/t/glib2-rb-thread-blocking-region-removed-from-ruby/239687/3 "2014-03-11T14:14:49Z")

</div>

Subject: Re: [ruby-gnome2-devel-en] glib2: rb\_thread\_blocking\_region  
removed from Ruby  
Date: mar 11 mar 14 10:09:44 +0900

Quoting Kouhei S. ([removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)):

> It is strange. I committed changes that support Ruby trunk a  
> few days ago.
> 
> Oh… I forgot to push the commit…  
> It didn’t included in Ruby-GNOME2 2.2.0…
> 
> I’ve pushed it now:

> <https://github.com/ruby-gnome/ruby-gnome/commit/c92a046cfe266cedbd59a40b31cfc9ea6e8ab300>
>
> Codes for Ruby 1.8 are dropped.

> It was my mistake. Sorry…

No problem. And thanks as usual for the huge effort you are putting on  
all of this.

Carlo

–

- 

```
    Se la Strada e la sua Virtu' non fossero state messe da 

```

parte,

- K \* Carlo E. Prelz - [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) che bisogno ci  
sarebbe
  - 

```
          di parlare tanto di amore e di rettitudine? 

```

(Chuang-Tzu)

---

<div class="post-metadata">

**Author:** ![Carlo\_ESPrelz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f07891/32.png) [@Carlo\_ESPrelz](https://www.ruby-forum.com/u/Carlo_ESPrelz)\
**Post date:** [March 11, 2014, 2:21pm UTC](https://www.ruby-forum.com/t/glib2-rb-thread-blocking-region-removed-from-ruby/239687/4 "2014-03-11T14:21:32Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] glib2: rb\_thread\_blocking\_region removed  
from Ruby” on Tue, 11 Mar 2014 14:14:13 +0100,  
“Carlo E. Prelz” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> No problem. And thanks as usual for the huge effort you are putting on  
> all of this.

Thanks. And thanks for your report. 🙂

–  
kou
