Re: Thread problem in Windows
- From: Filipe Apostolo <f apostolo cbr gmail com>
- To: gtkmm-list gnome org
- Subject: Re: Thread problem in Windows
- Date: Mon, 21 Sep 2009 16:53:11 +0100
Armin Burgmeier wrote:
> Filipe Apostolo wrote:
>> Armin Burgmeier wrote:
>>>> Glib::Thread *const opcWriterThread = Glib::Thread::create(
>>>> sigc::mem_fun(this, &MyClass::ThreadTest), true);
>>> Joining a thread means waiting for it to finish. So you are waiting
>>> for the thread here before running the dialog, which explains the
>>> behaviour you are experiencing.
>>> Try joining it afterwards, or make the thread non-joinable.
>> Thanks it worked, however the the main thread is sucked until the user
>> closes the window, how can I call it back without user interaction?
> Use .show() instead of .run().
I tried so, but the dialog appears only with the decoration, and inside
is transparent. I used .show_all_children() followed by .show_all() and
then by show_now(), but still transparent inside.
> To close the Window when the thread finishes, you can set up an idle
> handler in the thread right before it exits, and in your handler
> (which will then be executed by the main thread), call .hide() on the
I did not test this because of the previous behavior but instead of
using the dispatcher or another thread I used the createdThread->join()
in the parent thread before calling .hide(), assuming that he will stop
waiting for the thread to finish and then call the hide(), do you thing
that the problem is here? Thats the reason of the dialog appears
Meanwhile I'll try your solution.
> I think you can also use Glib::Dispatcher for the same task.
] [Thread Prev