Re: [gtkmm] asynchronous communication between threads
- From: Paul Davis <paul linuxaudiosystems com>
- To: Gene Ruebsamen <gene erachampion com>
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] asynchronous communication between threads
- Date: Tue, 23 Dec 2003 22:55:18 -0500
>I am new to thread programming, so this may be a stupid question but here goes...
its far from stupid, but also far from new.
>It's my understanding, at least for Gtk+, that when you have two threads that
>need to pass data between each other, it is better to use Asynchronous Queues
>(GAsyncQueue) defined in glib.h, rather than the more error prone shared memory.
>
>Looking through the Gtkmm reference, it appears that gtkmm does not support
>Asynchronous Queues. In my application, I have the main GUI thread, and a
>second thread that processes audio data and is suppose to update a graphical
>window in the GUI thread. So can anyone tell me what the preferred method of
>passing data between threads in a multi-threaded application is for Gtkmm?
Glib::Dispatcher
or you can roll your own if for some reason that doesn't appeal. use
pipes and lock free queues of SigC::Slots. easier to use the
ready-to-go solution.
ps. do not attempt to do GUI stuff in both threads. just notify the
GUI thread that there is work to do.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]