Forum: Ruby-Gnome 2 glib2: rb_thread_blocking_region removed from Ruby

3853dd5371ac1e094fc45d6c2aa0e459?d=identicon&s=25 Carlo E. Prelz (Guest)
on 2014-03-10 17:15
(Received via mailing list)
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,

2) adding a

#include <ruby/thread.h>

after including rgbprivate.h, in rbglib_maincontext.c, and

3) substituting

    rb_thread_blocking_region(rg_poll_in_blocking, &info, RUBY_UBF_IO,
NULL);

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 - fluido@fluido.as             che bisogno ci
sarebbe
  *               di parlare tanto di amore e di rettitudine?
(Chuang-Tzu)
Ee6ffca720cc428d70247dcd7377dd48?d=identicon&s=25 Kouhei Sutou (Guest)
on 2014-03-11 14:10
(Received via mailing list)
Hi,

In <20140310155731.GB19405@fluido.as>
  "[ruby-gnome2-devel-en] glib2: rb_thread_blocking_region removed from
Ruby" on Mon, 10 Mar 2014 16:57:31 +0100,
  "Carlo E. Prelz" <fluido@fluido.as> 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:
  https://github.com/ruby-gnome2/ruby-gnome2/commit/...

It was my mistake. Sorry...


Thanks,
--
kou
3853dd5371ac1e094fc45d6c2aa0e459?d=identicon&s=25 Carlo E. Prelz (Guest)
on 2014-03-11 14:14
(Received via mailing list)
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 Sutou (kou@cozmixng.org):

> 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-gnome2/ruby-gnome2/commit/...
>
> 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 - fluido@fluido.as             che bisogno ci
sarebbe
  *               di parlare tanto di amore e di rettitudine?
(Chuang-Tzu)
Ee6ffca720cc428d70247dcd7377dd48?d=identicon&s=25 Kouhei Sutou (Guest)
on 2014-03-11 14:21
(Received via mailing list)
Hi,

In <20140311131413.GA18593@fluido.as>
  "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" <fluido@fluido.as> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.