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

Fork of LcdWindow by Hendrik Lipka

semaphore.h

Committer:
charly
Date:
2016-01-13
Revision:
13:99b500b05716
Parent:
9:2fe93daa2106

File content as of revision 13:99b500b05716:

/**
 * code from Igor Skochinsky
 * taken from http://mbed.org/forum/mbed/post/799/
*/

#ifndef SEMAPHORE_H_
#define SEMAPHORE_H_

class Semaphore
{
public:
  // constructor
  Semaphore();
  
  // try to take the semaphore and return success
  // by default block until succeeded
  bool take(bool block = true);
  // release the semaphore
  void release();
  
  static void setAbort(bool abort){_abort=abort;};
  
 private:
   enum { SemFree, SemTaken };
  // semaphore value
  int s;  
  static bool _abort;

};

#endif