Re: signals and threads

On 12/7/05, Dmitry A. Yanko <fm cross-road org ua> wrote:
On Wed, Dec 07, 2005 at 12:46:28PM -0500, Tristan Van Berkom wrote:
May I just ask why you think you need to use threads in the
first place ?
It is more convenient. :)
It is difficult to handle many external events whithout threads.
Each event (data stream) needs own window and set of widgets (depends on data
type) to interact. Events may be handled in parallel.
I have no problems to use gtk without threads. I had no problems with pthreads
in past. But now... :)

I handle this by having data capture threads updating a common model
and signalling to the UI thread that things have changed. When it has
time, the UI thread then walks the common model and updates the parts
of the screen that need it.

You need a bit of buffering at data capture and you need the UI
thread's walk to be short. I have the capture thread hinting about the
parts that have changed, and the UI thread only walking the sections
which are currently visible on the screen.

It's only slightly more complex to set up this kind of thing (IMO) and
it keeps all the threading in one place. Much less confusing (for me).

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