/** * @author Edouard DUPIN * * @copyright 2011, Edouard DUPIN, all right reserved * * @license BSD v3 (see license file) */ #ifndef __ETK_MESSAGE_FIFO_H__ #define __ETK_MESSAGE_FIFO_H__ #include #include #include namespace etk { template class MessageFifo { private : etk::Mutex m_mutex; etk::Semaphore m_semaphore; etk::Vector m_data; public : MessageFifo(void) { // nothing to do ... }; ~MessageFifo(void) { // nothing to do ... }; bool Wait(MY_TYPE &data) { m_mutex.Lock(); // Check if data is not previously here while(0==m_data.Size()) { m_mutex.UnLock(); m_semaphore.Wait(); m_mutex.Lock(); } // End Waiting message : if (0