comp.lang.ada
 help / color / mirror / Atom feed
From: "Lucretia" <lucretia9@lycos.co.uk>
Subject: Re: Tasking and wxWidgets
Date: 28 Nov 2005 02:48:26 -0800
Date: 2005-11-28T02:48:26-08:00	[thread overview]
Message-ID: <1133174906.814986.234190@g47g2000cwa.googlegroups.com> (raw)
In-Reply-To: <1klj2l99vjffc.20si9rutfd0p.dlg@40tude.net>

> > Hmm, but if each wxAda type had it's own mutex, surely you'd only end
> > up locking that particular object at any one time?
>
> Depends on what is the object here, and what is allowed to do with a mutex
> taken. If there is a possibility to perform blocking actions within other
> actions, then be ready for hell. One way to get out of this is to remove
> mutexes from objects and pass them as parameters or discriminants. Another
> is to use monitor tasks.

The object could be any of the wx objects, a wxFrame, wxButton,
wxToolBar, wxStatusBar, etc.

> > It's a possibility if somebody wanted to create an image manipulation
> > program with wxAda?!
>
> Do you ask me? (:-)) Look at absolutely useless Window's SetPixel. Then
> you'll need double buffering and all that stuff.

No! I mean't it is possible that somebody would want to.

> >> often use a specialized "mutex" which allows parallel read access if there
> >> is no any write access. It would be nice to use Ada's protected objects
> >> here, because they basically have this functionality, but unfortunately 1)
> >> the thing is in C++, 2) Ada's protected objects aren't OO composable, they
> >> are not tagged.
> >
> > Exactly, and getting multiple objects using protected objects is
> > impossible, unfortunately.
>
> Hmm, do you mean multiple protected actions here?

No! I mean you cannot create derivable types from protected types. The
wxAda hierarchy matches that of the C++ wxWidgets hierarchy. wxObject
(wx.Base.Object.Object_Type) is the base type and everything derives
from there. wxEvtHandler (wx.Base.Event_Handler.Event_Handler_Type)
derives from wxObject. wxWindow derives from wxEvtHandler. wxControl
derives from wxWindow. etc.

So, how do you make this thread safe? All controls are windows and all
events go through the event handler classes. In the wxWidgets library
there is minimal thread safe code in the event handling code, but do I
want to make a completely thread safe library or leave it up to the
application developer?

> >> And more than two mutexes is a problem. You should try to make the API
> >> composable without or minimal deadlock danger. For example, Windows GUI API
> >
> > I'm not sure what you mean about "composable without or minimal
> > deadlock danger"
>
> From the messages loop [in a deeply nested callback subprogram] you spin
> for a mutex held by another thread that does SetWindowText to the window.
> Here you are.

Eh?

Thanks,
Luke.




  reply	other threads:[~2005-11-28 10:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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
replies disabled

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