Michael Moorman
Sat, 31 Dec 2011 23:47:02 -0800
Hi Kaiser, This one way I would approach this problem.
1. Launch a GLib::Thread to download the files. The API is quite nice and easy to use. 2. Register a timeout function on the main gtk loop that periodically checks (maybe once every half second) on the status of the thread you launched in 1 ( see http://developer.gnome.org/gtkmm-tutorial/3.2/sec-timeouts.html.en ). This can safely update anything on the GUI since it's invoked from the main loop. Update any GUI related things (progress bar, error/success indications, etc) using this function. Consider using a Glib::Mutex to facilitate safe communication between the two threads, i.e. synchronizing access to any shared buffer. Good luck! >________________________________ > From: Kaiser . <yahya...@hotmail.com> >To: gtkmm-list@gnome.org >Sent: Sunday, January 1, 2012 1:59 AM >Subject: Best and esiest to implemet pthread , GLib::Thread , GLib::Dispatcher > > > >Hello > >I have made small gtkmm program that download some files from Internet by >using libcurl.. > >But when the program start downloading the files it Freez until it finish (cuz >of single thread??).. > >I knew that I must implement multi-threading to solve the problem ... > >I have 3 classes in the program : WINDOW , APP , CURL > >// here are some brief of the program >CURL contains CURLREAD function to download the files and some helper functions >APP contains other utils of program and contains getPKG() which get the URLS >and download the files throught the object curl.curlread(url ,,,) >Window has progressBAR > >CURL is object on APP ,,,, and APP is object on WINDOW > >which one I should implement pthread , GLib::Thread or GLib::Dispatcher ?! > >_______________________________________________ >gtkmm-list mailing list >gtkmm-list@gnome.org >http://mail.gnome.org/mailman/listinfo/gtkmm-list > > >
_______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list