Nicolas Borla / Mbed OS PES2_mbed_os

Dependencies:   Servo

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     public:
00019         
00020                                 ThreadFlag();
00021         virtual                 ~ThreadFlag();
00022         virtual unsigned int    read();
00023                                 operator unsigned int();
00024         
00025     private:
00026         
00027         static unsigned int threadFlags;    // variable that holds all assigned thread flags
00028         unsigned int        threadFlag;     // thread flag of this object
00029         Mutex               mutex;          // mutex to lock critical sections
00030 };
00031 
00032 #endif /* THREAD_FLAG_H_ */
00033