1. -- The Completions package provides the Completion object, which notifies 
  2. -- threads when a pending operation is complete. 
  3. package Completions is 
  4.  
  5.     pragma Preelaborate; 
  6.  
  7.     -- A protected state object useful for notifying threads when an operation 
  8.     -- is complete. 
  9.     protected type Completion is 
  10.  
  11.         -- Notifies the object that the state is complete. This will unblock 
  12.         -- all threads blocked on the Wait entry. 
  13.         procedure Notify_Complete; 
  14.  
  15.         -- Checks the state of the object without waiting for it to be complete. 
  16.         function Is_Complete return Boolean; 
  17.  
  18.         -- Blocks the caller until the state becomes complete. 
  19.         entry Wait; 
  20.  
  21.     private 
  22.         complete : Boolean := False;    -- complete? 
  23.     end Completion; 
  24.     type A_Completion is access all Completion; 
  25.  
  26.     -- Deletes the Completion. 
  27.     procedure Delete( obj : in out A_Completion ); 
  28.     pragma Postcondition( obj = null ); 
  29.  
  30. end Completions;