Fork of LCD-Window which works with Enhanced TextLCD from Wim
Fork of LcdWindow by
Diff: semaphore.h
- Revision:
- 3:e5d5e2fe4bf6
- Child:
- 9:2fe93daa2106
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/semaphore.h Sun Nov 28 22:09:54 2010 +0000
@@ -0,0 +1,28 @@
+/**
+ * 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();
+
+ private:
+ enum { SemFree, SemTaken };
+ // semaphore value
+ int s;
+
+};
+
+#endif
