comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Tasking and wxWidgets
Date: Sat, 26 Nov 2005 07:46:15 +0000
Date: 2005-11-26T07:46:15+00:00	[thread overview]
Message-ID: <m2hd9zyhq0.fsf@grendel.local> (raw)
In-Reply-To: 1132913111.023558.255590@g14g2000cwa.googlegroups.com

"Lucretia" <lucretia9@lycos.co.uk> 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;



  parent reply	other threads:[~2005-11-26  7:46 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
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 [this message]
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