Re: Thread problem in Windows

Armin Burgmeier wrote:
> Filipe Apostolo wrote:
>> Armin Burgmeier wrote:
>>>>         Glib::Thread *const opcWriterThread = Glib::Thread::create(
>>>>              sigc::mem_fun(this, &MyClass::ThreadTest), true);
>>>>          opcWriterThread->join();
>>> 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.
>>> Armin
>> 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
> dialog.
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
transparent inside?
Meanwhile I'll try your solution.
> I think you can also use Glib::Dispatcher for the same task.
> Armin

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]