[Top][All Lists]

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

Re: [XForms] Xforms & threads-functions & others

From: Paul Nicholson
Subject: Re: [XForms] Xforms & threads-functions & others
Date: Fri, 11 Nov 2011 07:43:35 +0000
User-agent: Thunderbird (X11/20080421)

I have written several programs which operate on a real-time
data stream and use XForms for GUI.

They all use two threads: one to deal purely with the data
stream and the other for the GUI, almost exactly as Nick
described.  This allows smooth operation of the GUI and
data flow.

It is important to ensure that strictly only one thread
handles the GUI through the XForms library - otherwise one
gets those X Errors.  This is easy to achieve and leads to a
nicely structured program.

One must arrange a clear interface between the two threads,
using well defined shared variables to exchange events and
request services.  When not using pthreads and using fork/exec
instead, I define a data structure to hold all the shared
variables and create an instance of this in shared memory,
which is then mmap'ed into both processes.

In one case I used three processes: data stream, GUI, and
a third which ran any GUI-requested data processing such as
long analysis, output file creation, etc.  Then the GUI
remains responsive at all times.

I don't see why XForms needs to do multi-threading.

Paul Nicholson,
Todmorden, UK.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]