comp.lang.ada
 help / color / mirror / Atom feed
* Tasking and wxWidgets
@ 2005-11-25 10:05 Lucretia
  2005-11-25 10:53 ` Martin Dowie
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Lucretia @ 2005-11-25 10:05 UTC (permalink / raw)


I've posted this to the wxWidgets development list, but I thought I'd
post here as well to get the Ada perspective.

I'm probably going to answer my own question here, but here goes...

I know that wxWidgets isn't thread-safe. I know that the advice given
is to only do GUI related things in the main thread and to use worker
threads as and when required to do other stuff and post the results
back to the main thread via some sort of intermediary event queue or
somesuch. But, there are a few things I would like to discuss with
other developers here before I decide what to do with respect to wxAda.

1) Is there any situation where having multiple threads with it's own
(or shared) GUI makes sense? Can anybody actually think of any examples
where, say, a frame has multiple threads and they all (or some) want to
update the GUI?

As an example, say you have an monitoring application which has on it a
number of controls, e.g. temperature, pressure guages, It would be
possible to set up two threads which monitor the actual sensors and
send events directly to the temperature/pressure wxGuage controls.

Another example would be to provide a log window in which error
messages from these same sensors could be dumped, in this case the
wxEvtHandler derived class is accessed by two different threads
concurrently and would need t synchronised.

2) How portable wuold this be exactly? Could I compile the same code
and have it work correctly on Linux, Win32 and MacOS?

Now, coming round to wxAda, I need to determine what exactly to do:

1) I could provide no support for tasking (multithreading) and require
that the application developer protect his/her own code.

2) I could also go the other way and inside the
wx.Base.Object.Object_Type (wxObject) provide a mutex object, such that
every call in wxAda would lock (on entry) and unlock (on exit) thus
providing thread safety if that particular object were accessed via
multiple tasks. The overhead of constructing/destructing a mutex locker
object, locking/unlocking the mutex object on every call would be
rather high and thus, would most probably slow the application down to
a crawl (although, not tested). Use of inlining might make this nicer?

3) I could go part-way and only provide concurrent access to the event
sending functions.

4) Is it possible that the synchronisation code that *is* in the
wxWidgets library (I'm not talking about the actual wxThread,
wxSemaphore, etc. classes here, but the places where there is critical
sections to protect concurrent access) could interfere with Ada's
tasking and protected types (Ada's implementation of monitors)?

Thanks,
Luke.




^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2005-11-29 22:46 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-25 10:05 Tasking and wxWidgets Lucretia
2005-11-25 10:53 ` Martin Dowie
2005-11-26 17:32   ` Lucretia
2005-11-26 18:23     ` Martin Dowie
2005-11-29  3:07       ` Randy Brukardt
2005-11-29  9:13         ` Martin Dowie
2005-11-29 21:46           ` Randy Brukardt
2005-11-29 22:46             ` Martin Dowie
2005-11-25 11:37 ` Dmitry A. Kazakov
2005-11-26 17:26   ` Lucretia
2005-11-27 11:15     ` Dmitry A. Kazakov
2005-11-28 10:48       ` Lucretia
2005-11-28 14:41         ` Dmitry A. Kazakov
2005-11-26 17:26   ` Lucretia
2005-11-26 17:28   ` Lucretia
2005-11-26 17:34   ` Lucretia
2005-11-26  7:46 ` Simon Wright
2005-11-28 10:37   ` Lucretia
2005-11-29 21:38     ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox