Michael Ernst Peter / PM2_Libary

Dependencies:   LSM9DS1 RangeFinder FastPWM

Dependents:   PM2_Example_PES_board PM2_Example_PES_board PM2_Example_PES_board PM2_Example_PES_board ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ThreadFlag.h Source File

ThreadFlag.h

00001 /*
00002  * ThreadFlag.h
00003  * Copyright (c) 2020, ZHAW
00004  * All rights reserved.
00005  */
00006 
00007 #ifndef THREAD_FLAG_H_
00008 #define THREAD_FLAG_H_
00009 
00010 #include <cstdlib>
00011 #include <mbed.h>
00012 
00013 /**
00014  * This class manages the handling of unique thread flags to trigger rtos threads.
00015  */
00016 class ThreadFlag
00017 {
00018 
00019 public:
00020 
00021     ThreadFlag();
00022     virtual                 ~ThreadFlag();
00023     virtual unsigned int    read();
00024     operator unsigned int();
00025 
00026 private:
00027 
00028     static unsigned int threadFlags;    // variable that holds all assigned thread flags
00029     unsigned int        threadFlag;     // thread flag of this object
00030     Mutex               mutex;          // mutex to lock critical sections
00031 };
00032 
00033 #endif /* THREAD_FLAG_H_ */
00034