================================================================ This is the pseudocode for a circular buffer in which the writer blocks if the buffer is full, and the reader blocks if the buffer is empty. B: array (0 .. N-1) of Integer; In_Ptr, Out_Ptr: Integer := 0; El: Semaphore := 0; Sp: Semaphore := N; task body Producer is I: Integer; begin loop Produce(I); Wait (Sp); B(In_Ptr) := I; In_Ptr := (In_Ptr + 1) mod N; Signal (El); end loop; end Producer; task body Consumer is I: Integer; begin loop Wait (El); I := B(Out_Ptr); Out_Ptr := (Out_Ptr + 1) mod N; Signal (Sp); Consume (I); end loop; end Consumer; ================================================================ This is the pseudocode for a circular buffer in which the writer drops the data (without blocking) if the buffer is full, and the reader blocks if the buffer is empty. This is most likely what you have to use in the RAP implementation. B: array (0 .. N-1) of Integer; In_Ptr, Out_Ptr: Integer := 0; El: Semaphore := 0; Sp: Semaphore := N; task body Producer is I: Integer; begin loop Produce(I); if TryWait (Sp) = EAGAIN: else: B(In_Ptr) := I; In_Ptr := (In_Ptr + 1) mod N; Signal (El); end if end loop; end Producer; task body Consumer is I: Integer; begin loop Wait (El); I := B(Out_Ptr); Out_Ptr := (Out_Ptr + 1) mod N; Signal (Sp); Consume (I); end loop; end Consumer;