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
- Committer:
- hlipka
- Date:
- 2010-11-28
- Revision:
- 3:e5d5e2fe4bf6
- Child:
- 9:2fe93daa2106
File content as of revision 3:e5d5e2fe4bf6:
/**
* 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
