comp.lang.ada
 help / color / mirror / Atom feed
* Question on using protected objects
@ 2001-09-29  3:45 DuckE
  2001-09-29  6:16 ` Jeffrey Carter
  2001-09-29 17:29 ` Tucker Taft
  0 siblings, 2 replies; 8+ messages in thread
From: DuckE @ 2001-09-29  3:45 UTC (permalink / raw)


Without getting into the details of what I'm leading up to, is the line
marked in the text
code snippet below a valid thing to do?

  SUBTYPE aWaitSelect IS INTEGER RANGE 1 .. 3;
  TYPE aWaitArray IS ARRAY( aWaitSelect ) OF BOOLEAN;

  PROTECTED TYPE aQueueingType IS
    ENTRY GetEntry( waitSelect  : aWaitSelect; getResult : out Integer );
    PROCEDURE Release( waitSelect  : aWaitSelect );
  PRIVATE
    ENTRY WaitForIt( aWaitSelect );
    waitFlag : aWaitArray := ( OTHERS => FALSE );
    counter  : Natural := 0;
  END aQueueingType;

  PROTECTED BODY aQueueingType IS
    PROCEDURE Release( waitSelect : aWaitSelect ) IS
    BEGIN
      waitFlag( waitSelect  ) := TRUE;
    END Release;
    ENTRY GetEntry( waitSelect : aWaitSelect;
                     getResult : out Integer ) WHEN GetEntry'COUNT = 0 IS
    BEGIN
      getResult := counter;
      counter := counter + 1;
      REQUEUE WaitForIt( waitSelect );
    END GetEntry;
    ENTRY WaitForIt ( FOR waitSelect IN aWaitSelect )
         WHEN waitFlag( waitSelect ) IS  -- <<<<<<<<<<<< is it OK to use
waitSelect here???
    BEGIN
      waitFlag( waitSelect ) := FALSE;
    END WaitForIt;
  END aQueueingType;


Thanks in advance,
SteveD






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

end of thread, other threads:[~2001-09-29 19:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-29  3:45 Question on using protected objects DuckE
2001-09-29  6:16 ` Jeffrey Carter
2001-09-29 12:30   ` DuckE
2001-09-29 14:20     ` Jeff Creem
2001-09-29 15:09       ` DuckE
2001-09-29 17:24     ` Ehud Lamm
2001-09-29 17:29 ` Tucker Taft
2001-09-29 19:01   ` DuckE

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