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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1742659b6aa943fb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.vmunix.org!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Tasking and wxWidgets Date: Sat, 26 Nov 2005 07:46:15 +0000 Organization: Pushface Message-ID: References: <1132913111.023558.255590@g14g2000cwa.googlegroups.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.demon.co.uk 1132991173 9833 62.49.19.209 (26 Nov 2005 07:46:13 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sat, 26 Nov 2005 07:46:13 +0000 (UTC) Cancel-Lock: sha1:0l3WVvzOqIFiejUWC8Ot/btlUgU= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) Xref: g2news1.google.com comp.lang.ada:6635 Date: 2005-11-26T07:46:15+00:00 List-Id: "Lucretia" writes: > 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? Not clear that inlining would help a lot here. What would be acceptable? Using a Lock from the Booch �components (http://booch95.sourceforge.net) takes just under 20 us on a 1.5GHz Powerbook. with Ada.Text_IO; use Ada.Text_IO; with BC.Support.High_Resolution_Time; with BC.Support.Synchronization; procedure Time_Lock is Mutex : aliased BC.Support.Synchronization.Semaphore; Start, Finish : BC.Support.High_Resolution_Time.Time; use type BC.Support.High_Resolution_Time.Time; begin Start := BC.Support.High_Resolution_Time.Clock; declare L : BC.Support.Synchronization.Lock (Mutex'Access); pragma Unreferenced (L); begin -- Mutex now secured and will be released on block exit (even -- on exception) null; end; Finish := BC.Support.High_Resolution_Time.Clock; Put_Line ("took " & Duration'Image (Finish - Start)); end Time_Lock;