while (1) #Infinite loop { threads->yield(); #Yield each iteration lock($Buffer); #Lock buffer to prevent taking a partialy filled buffer. last if ($Buffer); #If the buffer is filled continue. }