comp.lang.ada
 help / color / mirror / Atom feed
* Unreferenced lock variables
@ 1999-04-11  0:00 Simon Wright
  1999-04-11  0:00 ` Tom Moran
  1999-04-12  0:00 ` Robert Dewar
  0 siblings, 2 replies; 24+ messages in thread
From: Simon Wright @ 1999-04-11  0:00 UTC (permalink / 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?






^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~1999-04-21  0:00 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-11  0:00 Unreferenced lock variables Simon Wright
1999-04-11  0:00 ` 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       ` Simon Wright
1999-04-14  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-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-16  0:00                   ` Tom Moran
1999-04-19  0:00                     ` Tucker Taft
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

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