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

Re: threads and trayicon error



anguila wrote:

> I use 2 threads, the first one, execute the cvnews.pl to get the news, and
> the second wait $wait_time_error (the time acces to get the info from the
> web) to join the first thread for update the trayicon online or offline.

I'd suggest not using threads for this purpose... too complicated and 
error-prone. It's not allowed to call Gtk+ functions outside the thread
which started the main loop, so you need to start a pure worker thread 
communicating with the main thread to update the GUI etc.

You already have a separate process for the http stuff, so it's easy to
install an I/O watcher on your pipe and response to the events instead 
of struggling with threads.

That's very common and you find an example for this in Gtk Perl docs, 
e.g. here:

  http://live.gnome.org/GTK2-Perl/FrequentlyAskedQuestions#head-20b1c1d3a92f0c61515cb88d15e06b686eba6cbc

  [ 18. How do I keep my GUI updating while doing a long file read? ]

Regards,

Jörn

-- 
Think before you code. And while you're doing it probably won't hurt. ;)

Attachment: pgpcPjipedRGy.pgp
Description: PGP signature



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