diff --git a/miosix/kernel/sync.h b/miosix/kernel/sync.h index bc9913128ebb25e4c53d94186a2af617d64037f4..cadae7c7b13cac35a911588e9feb9d4b9c637ae3 100644 --- a/miosix/kernel/sync.h +++ b/miosix/kernel/sync.h @@ -391,12 +391,12 @@ private: * variable or on a semaphore. It is used by the kernel, and should not be used * by end users. */ -class WaitToken : public IntrusiveListItem -{ -public: - WaitToken(Thread *thread) : thread(thread) {} - Thread *thread; ///<\internal Thread that is waiting -}; +// class WaitToken : public IntrusiveListItem +// { +// public: +// WaitToken(Thread *thread) : thread(thread) {} +// Thread *thread; ///<\internal Thread that is waiting +// }; /** * A condition variable class for thread synchronization, available from @@ -521,7 +521,21 @@ public: if(doBroadcast()) Thread::yield(); } + //Unwanted methods + ConditionVariable(const ConditionVariable&) = delete; + ConditionVariable& operator= (const ConditionVariable&) = delete; + private: + /** + * \internal Element of a thread waiting list + */ + class WaitToken : public IntrusiveListItem + { + public: + WaitToken(Thread *thread) : thread(thread) {} + Thread *thread; ///<\internal Waiting thread + }; + /** * Wakeup one waiting thread. * Currently implemented policy is fifo. @@ -536,10 +550,6 @@ private: */ bool doBroadcast(); - //Unwanted methods - ConditionVariable(const ConditionVariable&) = delete; - ConditionVariable& operator= (const ConditionVariable&) = delete; - friend int ::pthread_cond_destroy(pthread_cond_t *); //Needs condList friend int ::pthread_cond_signal(pthread_cond_t *); //Needs doSignal() friend int ::pthread_cond_broadcast(pthread_cond_t *); //Needs doBroadcast() @@ -636,11 +646,21 @@ public: */ unsigned int getCount() { return count; } -private: // Disallow copies Semaphore(const Semaphore&) = delete; Semaphore& operator= (const Semaphore&) = delete; +private: + /** + * \internal Element of a thread waiting list + */ + class WaitToken : public IntrusiveListItem + { + public: + WaitToken(Thread *thread) : thread(thread) {} + Thread *thread; ///<\internal Waiting thread and spurious wakeup token + }; + /** * \internal * Internal method that signals the semaphore without triggering a