1. with System.Storage_Pools; 
  2.  
  3. private with System; 
  4. private with System.Storage_Elements; 
  5.  
  6. package Recycling_Pools is 
  7.  
  8.     pragma Elaborate_Body; 
  9.  
  10.     -- Recycling pool with free list and reclaim 
  11.     type Recycling_Pool is new System.Storage_Pools.Root_Storage_Pool with private; 
  12.  
  13. private 
  14.  
  15.     use System; 
  16.  
  17.     protected type Simple_Lock is 
  18.         entry Lock; 
  19.         procedure Unlock; 
  20.     private 
  21.         unlocked : Boolean := True; 
  22.     end Simple_Lock; 
  23.  
  24.     type Recycling_Pool is new System.Storage_Pools.Root_Storage_Pool with 
  25.         record 
  26.             used, 
  27.             freed : System.Address := Null_Address; 
  28.             lock  : Simple_Lock; 
  29.         end record; 
  30.  
  31.     procedure Allocate( this        : in out Recycling_Pool; 
  32.                         address     : out System.Address; 
  33.                         storageSize : System.Storage_Elements.Storage_Count; 
  34.                         alignment   : System.Storage_Elements.Storage_Count ); 
  35.  
  36.     procedure Deallocate( this        : in out Recycling_Pool; 
  37.                           address     : System.Address; 
  38.                           storageSize : System.Storage_Elements.Storage_Count; 
  39.                           alignment   : System.Storage_Elements.Storage_Count ); 
  40.  
  41.     procedure Finalize( this : in out Recycling_Pool ); 
  42.  
  43.     function Storage_Size( this : Recycling_Pool ) return System.Storage_Elements.Storage_Count; 
  44.  
  45. end Recycling_Pools;