-- locks.adb -- a simple use of protected type defining a lock -- a lock protects a specific resource from concurrent use with Ada.Text_IO; procedure locks is -- just a demonstration protected type Resource is -- this would typically be entry Seize; -- in a package and be "withed" procedure Release; -- only one is needed other than private -- your choice of names Busy : Boolean := false; end Resource; protected body Resource is entry Seize when not Busy is begin Busy := true; -- our only job here is to set the lock end Seize; procedure Release is begin Busy := false; -- just a procedure to unset the lock end Release; end Resource; -- Each lock is for an individual resource, -- use as many as you need. Lock1 : Resource; Lock2 : Resource; IO_Channel_7 : Resource; FIFO_Input_Buffer : Resource; Mutex : Resource; begin Ada.Text_IO.Put_Line("locks running"); Lock1.Seize; -- These would normally be in tasks or Lock2.Seize; -- other protected structures Lock2.Release; IO_Channel_7.Seize; Mutex.Release; Ada.Text_IO.Put_Line("locks finished"); end Locks;