Fork of LCD-Window which works with Enhanced TextLCD from Wim

Fork of LcdWindow by Hendrik Lipka

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers semaphore.h Source File

semaphore.h

00001 /**
00002  * code from Igor Skochinsky
00003  * taken from http://mbed.org/forum/mbed/post/799/
00004 */
00005 
00006 #ifndef SEMAPHORE_H_
00007 #define SEMAPHORE_H_
00008 
00009 class Semaphore
00010 {
00011 public:
00012   // constructor
00013   Semaphore();
00014   
00015   // try to take the semaphore and return success
00016   // by default block until succeeded
00017   bool take(bool block = true);
00018   // release the semaphore
00019   void release();
00020   
00021   static void setAbort(bool abort){_abort=abort;};
00022   
00023  private:
00024    enum { SemFree, SemTaken };
00025   // semaphore value
00026   int s;  
00027   static bool _abort;
00028 
00029 };
00030 
00031 #endif