# FileUtils, Threads, and Gtk

**URL:** <https://www.ruby-forum.com/t/fileutils-threads-and-gtk/190360>\
**Category:** Ruby-Gnome 2\
**Created:** [June 18, 2010, 1:36pm UTC](https://www.ruby-forum.com/t/fileutils-threads-and-gtk/190360 "2010-06-18T13:36:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikolai\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@Nikolai\_W](https://www.ruby-forum.com/u/Nikolai_W)\
**Post date:** [June 18, 2010, 1:36pm UTC](https://www.ruby-forum.com/t/fileutils-threads-and-gtk/190360/1 "2010-06-18T13:36:26Z")

</div>

Hi!

The following code seems to lock up an never complete on 1.8.7:

require ‘gtk2’

Gtk.init\_add do  
Thread.start do  
FileUtils.cp ‘a’, ‘b’  
Gtk.main\_quit  
end  
end

Gtk.main

For any file a.

Using code similar to that shown in

[http://ruby-gnome2.sourceforge.jp/hiki.cgi?tips\_threadshttp://ruby-gnome2.sourceforge.jp/hiki.cgi?tips\_threads](http://ruby-gnome2.sourceforge.jp/hiki.cgi?tips_threadshttp://ruby-gnome2.sourceforge.jp/hiki.cgi?tips_threads)

works, but is very slow.

Has anyone encountered similar problems? Anyone have any experience  
with threads and 1.9.1?

---

<div class="post-metadata">

**Author:** ![Nikolai\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@Nikolai\_W](https://www.ruby-forum.com/u/Nikolai_W)\
**Post date:** [June 18, 2010, 5:36pm UTC](https://www.ruby-forum.com/t/fileutils-threads-and-gtk/190360/2 "2010-06-18T17:36:27Z")

</div>

Gtk.main\_quit in a Thread?

I don’t think it will ever causes a “great success”…

---

<div class="post-metadata">

**Author:** ![Nikolai\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@Nikolai\_W](https://www.ruby-forum.com/u/Nikolai_W)\
**Post date:** [June 19, 2010, 3:09am UTC](https://www.ruby-forum.com/t/fileutils-threads-and-gtk/190360/3 "2010-06-19T03:09:00Z")

</div>

On Fri, Jun 18, 2010 at 17:35, KONTRA, Gergely [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Gtk.main\_quit in a Thread?
> 
> I don’t think it will ever causes a “great success”…

Donâ€™t top-post and, seriously, that wasnâ€™t the issue here.

---

<div class="post-metadata">

**Author:** ![Nikolai\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@Nikolai\_W](https://www.ruby-forum.com/u/Nikolai_W)\
**Post date:** [June 19, 2010, 5:01am UTC](https://www.ruby-forum.com/t/fileutils-threads-and-gtk/190360/4 "2010-06-19T05:01:57Z")

</div>

On 19 June 2010 10:08, Nikolai W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Fri, Jun 18, 2010 at 17:35, KONTRA, Gergely [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Gtk.main\_quit in a Thread?
> > 
> > I don’t think it will ever causes a “great success”…
> 
> Donâ€™t top-post and, seriously, that wasnâ€™t the issue here.

Actually, that would have been my first guess too. What  
was the issue?

```
    MikeC

```

---

<div class="post-metadata">

**Author:** ![Nikolai\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@Nikolai\_W](https://www.ruby-forum.com/u/Nikolai_W)\
**Post date:** [June 19, 2010, 11:33am UTC](https://www.ruby-forum.com/t/fileutils-threads-and-gtk/190360/5 "2010-06-19T11:33:30Z")

</div>

On Sat, Jun 19, 2010 at 05:01, Mike C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> On 19 June 2010 10:08, Nikolai W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > On Fri, Jun 18, 2010 at 17:35, KONTRA, Gergely [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > 
> > > Gtk.main\_quit in a Thread?
> > > 
> > > I don’t think it will ever causes a “great success”…
> > 
> > Donâ€™t top-post and, seriously, that wasnâ€™t the issue here.
> 
> Actually, that would have been my first guess too. Â What  
> was the issue?

It doesnâ€™t matter, as it never reaches the Gtk.main\_quit, which,  
perhaps, should be enqueued in the way described in the article I  
mentioned as well.
