# Re: \[Patch\] handle glib signals coming from different thread

**URL:** <https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749>\
**Category:** Ruby-Gnome 2\
**Created:** [April 8, 2006, 2:30pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749 "2006-04-08T14:30:47Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 23, 2006, 1:11am UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/21 "2006-05-23T01:11:09Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] [Patch] handle glib signals coming from  
different threads” on Tue, 23 May 2006 02:00:10 +0900,  
Masao M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > Ok, after some valgrinding it seems that the gc was messing with the created  
> > > thread for some reason… Fixed in this patch.
> > 
> > In my environment, it seems this patch fixes this problem.
> 
> Could you tell me more detail about your environment?

I’m sorry, I should show detail about my environment. Here  
is my environment:

% pkg-config --modversion gstreamer-0.8  
0.8.12  
% pkg-config --modversion glib-2.0  
2.10.2  
% ruby -v  
ruby 1.8.4 (2005-12-24) [i486-linux]

I’m using Debian/GNU Linux unstable.

## Thanks,

kou

* * *

Using Tomcat but need to do more? Need to support web services,  
security?  
Get stuff done quickly with pre-integrated technology to make your job  
easier  
Download IBM WebSphere Application Server v.1.0.1 based on Apache  
Geronimo  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642)

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 23, 2006, 5:43pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/22 "2006-05-23T17:43:43Z")

</div>

Hi,

On Tue, 23 May 2006 00:20:31 +0200  
removed\_email\_address@domain.invalid (Sjoerd S.) wrote:

> > > Then i’m out of ideas. I’ve attached a version with various printf’s for  
> > > debugging. If possible could you also provide a valgrind log and a gdb  
> > > ``thread apply all bt full’’ traceback ?
> > 
> > OK, here is a gdb log.
> 
> Ah, i think i know what’s going wrong… The output shows you get a normal  
> callback, while the traceback indicates that it comes from another thread…  
> This probably means that your ruby isn’t configured with --enable-pthread. Can  
> you check that?

Sure. I don’t use any options when I configured ruby.  
I tried latest ruby in CVS (1.9.0) with --enable-pthread, your patch  
works.

> If --enable-pthread isn’t enabled then is\_ruby\_native\_thread() will always  
> return true, causing the normal codepath to be used (which is basically the  
> same as what happens to an unpatched version)…

AFAIK, --enable-pthread is option(not standard) now, isn’t it?

So, if your patch doesn’t influence ruby with --disable-pthread option,  
I’ll apply your patch to CVS.

What do you think?

–  
.:% Masao M.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

* * *

Using Tomcat but need to do more? Need to support web services,  
security?  
Get stuff done quickly with pre-integrated technology to make your job  
easier  
Download IBM WebSphere Application Server v.1.0.1 based on Apache  
Geronimo  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642)

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 23, 2006, 7:14pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/23 "2006-05-23T19:14:39Z")

</div>

On Wed, May 24, 2006 at 12:42:09AM +0900, Masao M. wrote:

> I tried latest ruby in CVS (1.9.0) with --enable-pthread, your patch works.  
> What do you think?  
> Sounds great. Very nice to have this mystery solved 🙂 I’ve attached a  
> version  
> of the patch that only enables the code when HAVE\_NATIVETHREAD is  
> defined (thus  
> when ruby is compiled with --enable-pthread).

I’ll add a note to my ruby gst 0.10 bindings that people should really  
use a  
ruby version compiled with --enable-pthread. You might want to do that  
for ruby  
gstreamer 0.8 (as that should improve stability a lot).

For the record, Debian’s ruby is compiled with --enable-pthread by  
default  
while Fedora’s ruby uses --disable-pthread.

Sjoerd

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 26, 2006, 6:02pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/24 "2006-05-26T18:02:28Z")

</div>

Hi Sjoerd,

OK. Applied it, too.

On Tue, 23 May 2006 19:12:26 +0200  
removed\_email\_address@domain.invalid (Sjoerd S.) wrote:

> > Sure. I don’t use any options when I configured ruby.
> 
> For the record, Debian’s ruby is compiled with --enable-pthread by default  
> while Fedora’s ruby uses --disable-pthread.
> 
> ## Sjoerd
> 
> If they can make penicillin out of moldy bread, they can sure make  
> something out of you.  
> – Muhammad Ali

## –

.:% Masao M.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

* * *

All the advantages of Linux Managed Hosting–Without the Cost and Risk!  
Fully trained technicians. The highest number of Red Hat certifications  
in  
the hosting industry. Fanatical Support. Click to learn more  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642)

[Previous page](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749.md?page=1)
