comp.lang.ada
 help / color / mirror / Atom feed
From: "DuckE" <nospam_steved94@home.com>
Subject: Question on using protected objects
Date: Sat, 29 Sep 2001 03:45:53 GMT
Date: 2001-09-29T03:45:53+00:00	[thread overview]
Message-ID: <Rtbt7.51417$QK.34810279@news1.sttln1.wa.home.com> (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






             reply	other threads:[~2001-09-29  3:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-29  3:45 DuckE [this message]
2001-09-29  6:16 ` Question on using protected objects 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
replies disabled

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