comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pogner.demon.co.uk>
Subject: Unreferenced lock variables
Date: 1999/04/11
Date: 1999-04-11T00:00:00+00:00	[thread overview]
Message-ID: <x7v4smnszvu.fsf@pogner.moho> (raw)

I've been looking at using a 'control by allocation' technique (I'm
sure there's a more standard name, but I can't find it at the moment:
a resource is encapsulated in a type such that declaring an object of
the type allocates the resource).

For example,

  procedure Mark (R : in out Synchronized_Unbounded_Ring) is
    Lock : BC.Support.Synchronization.Write_Lock (R.The_Monitor);
  begin
    Mark (Unbounded_Ring (R));
  end Mark;

where the initialization of Lock calls the appropriate operations on
R.The_Monitor (which is a class-wide access ..) to ensure exclusion,
in this case for a Writer.

Now, GNAT quite properly warns me that Lock is unused; so, having been
bitten this way once, I cast around and found that inserting

    pragma Volatile (Lock);

will eliminate the warning.

However, it doesn't seem to be as legitimate a use as in the recent
thread on Handling Addressing Errors; is there a better way? pragma
Import (Ada, Lock) perhaps? or should I look for a different style?






             reply	other threads:[~1999-04-11  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-11  0:00 Simon Wright [this message]
1999-04-11  0:00 ` Unreferenced lock variables Tom Moran
1999-04-12  0:00 ` Robert Dewar
1999-04-12  0:00   ` Simon Wright
1999-04-12  0:00     ` Robert Dewar
1999-04-12  0:00       ` Jean-Pierre Rosen
1999-04-12  0:00         ` Simon Wright
1999-04-13  0:00         ` Robert Dewar
1999-04-13  0:00         ` Robert Dewar
1999-04-12  0:00       ` Simon Wright
1999-04-14  0:00         ` Robert Dewar
1999-04-13  0:00       ` Tom Moran
1999-04-15  0:00         ` Robert Dewar
1999-04-15  0:00           ` Tom Moran
1999-04-16  0:00             ` Robert Dewar
1999-04-16  0:00               ` Tom Moran
1999-04-16  0:00                 ` Tucker Taft
1999-04-16  0:00                   ` Tom Moran
1999-04-19  0:00                     ` Tucker Taft
1999-04-16  0:00                   ` Tom Moran
1999-04-20  0:00         ` Tom Moran
1999-04-20  0:00           ` Robert Dewar
1999-04-20  0:00             ` Tom Moran
1999-04-21  0:00               ` Robert Dewar
replies disabled

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