From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1742659b6aa943fb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!newsfeed.stueberl.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed01.chello.at!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Tasking and wxWidgets Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1132913111.023558.255590@g14g2000cwa.googlegroups.com> <12gydxpbzl6wr$.u5gqms25vc8n.dlg@40tude.net> <1133019723.900827.144340@o13g2000cwo.googlegroups.com> <1klj2l99vjffc.20si9rutfd0p.dlg@40tude.net> <1133174906.814986.234190@g47g2000cwa.googlegroups.com> Date: Mon, 28 Nov 2005 15:41:49 +0100 Message-ID: NNTP-Posting-Date: 28 Nov 2005 15:41:49 MET NNTP-Posting-Host: 43f0d9a8.newsread4.arcor-online.net X-Trace: DXC=cbH6OfaZ28E[T26?78J:ejgIfPPldDjW\KbG]kaMHFYk:AnJB[CM\T;j\HHYbcA[6LHn;2LCVN7enW;^6ZC`D<=9bOTW=MNN X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:6657 Date: 2005-11-28T15:41:49+01:00 List-Id: On 28 Nov 2005 02:48:26 -0800, Lucretia wrote: > The object could be any of the wx objects, a wxFrame, wxButton, > wxToolBar, wxStatusBar, etc. This is rather a "visual" hierarchy, i.e. things are arranged on the screen. But how does it work. Does wxButton send a message to wxFrame, or wxFrame queries wxButton for its state, or maybe wxButton has On_Click abstract method to override etc. > No! I mean you cannot create derivable types from protected types. Yes. However you can: type Protected_Action is abstract tagged ... procedure Perform (What : in out Protected_Action) is abstract; protected type Subject is entry Request (What : in out Protected_Action'Class); ... protected body Subject is entry Request (What : in out Protected_Action'Class) ... is begin Perform (What); -- Dispatches end; Yet, it would be a very bad idea to perform rendering from a protected action. > 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. Does wxEvtHandler encapsulate a thread? > 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? I will be difficult if possible in thin bindings if the library design wasn't thread safe. >>>> 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? The messages loop waits for the mutex. The thread holding the mutex waits for SendMessage to return the result. Deadlock. Things like this happen. [ The design problem is that rendering actions (like SetWindowText) and semantic actions (potentially lengthy and serialized) are served by the same thread. ] -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de