Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of LcdWindow by
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
Generated on Tue Jul 12 2022 20:32:52 by
1.7.2
