Nicolas Borla
/
PES2_mbed_os
PES2_mbed_os_6
ThreadFlag.h@3:a292bdaf03f6, 2021-03-16 (annotated)
- Committer:
- boro
- Date:
- Tue Mar 16 17:28:04 2021 +0100
- Revision:
- 3:a292bdaf03f6
- Parent:
- 0:5d4d21d56334
controller updated
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
boro | 0:5d4d21d56334 | 1 | /* |
boro | 0:5d4d21d56334 | 2 | * ThreadFlag.h |
boro | 0:5d4d21d56334 | 3 | * Copyright (c) 2020, ZHAW |
boro | 0:5d4d21d56334 | 4 | * All rights reserved. |
boro | 0:5d4d21d56334 | 5 | */ |
boro | 0:5d4d21d56334 | 6 | |
boro | 0:5d4d21d56334 | 7 | #ifndef THREAD_FLAG_H_ |
boro | 0:5d4d21d56334 | 8 | #define THREAD_FLAG_H_ |
boro | 0:5d4d21d56334 | 9 | |
boro | 0:5d4d21d56334 | 10 | #include <cstdlib> |
boro | 0:5d4d21d56334 | 11 | #include <mbed.h> |
boro | 0:5d4d21d56334 | 12 | |
boro | 0:5d4d21d56334 | 13 | /** |
boro | 0:5d4d21d56334 | 14 | * This class manages the handling of unique thread flags to trigger rtos threads. |
boro | 0:5d4d21d56334 | 15 | */ |
boro | 0:5d4d21d56334 | 16 | class ThreadFlag { |
boro | 0:5d4d21d56334 | 17 | |
boro | 0:5d4d21d56334 | 18 | public: |
boro | 0:5d4d21d56334 | 19 | |
boro | 0:5d4d21d56334 | 20 | ThreadFlag(); |
boro | 0:5d4d21d56334 | 21 | virtual ~ThreadFlag(); |
boro | 0:5d4d21d56334 | 22 | virtual unsigned int read(); |
boro | 0:5d4d21d56334 | 23 | operator unsigned int(); |
boro | 0:5d4d21d56334 | 24 | |
boro | 0:5d4d21d56334 | 25 | private: |
boro | 0:5d4d21d56334 | 26 | |
boro | 0:5d4d21d56334 | 27 | static unsigned int threadFlags; // variable that holds all assigned thread flags |
boro | 0:5d4d21d56334 | 28 | unsigned int threadFlag; // thread flag of this object |
boro | 0:5d4d21d56334 | 29 | Mutex mutex; // mutex to lock critical sections |
boro | 0:5d4d21d56334 | 30 | }; |
boro | 0:5d4d21d56334 | 31 | |
boro | 0:5d4d21d56334 | 32 | #endif /* THREAD_FLAG_H_ */ |
boro | 0:5d4d21d56334 | 33 |