![](/media/cache/profiles/altb_JGUSAOG.jpg.50x50_q85.jpg)
corrections altb2
Lib_Misc/ThreadFlag.h@0:d2e117716219, 2021-05-02 (annotated)
- Committer:
- altb2
- Date:
- Sun May 02 19:32:30 2021 +0000
- Revision:
- 0:d2e117716219
1st commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
altb2 | 0:d2e117716219 | 1 | /* |
altb2 | 0:d2e117716219 | 2 | * ThreadFlag.h |
altb2 | 0:d2e117716219 | 3 | * Copyright (c) 2019, ZHAW |
altb2 | 0:d2e117716219 | 4 | * All rights reserved. |
altb2 | 0:d2e117716219 | 5 | * |
altb2 | 0:d2e117716219 | 6 | * Created on: 29.11.2019 |
altb2 | 0:d2e117716219 | 7 | * Author: Marcel Honegger |
altb2 | 0:d2e117716219 | 8 | */ |
altb2 | 0:d2e117716219 | 9 | |
altb2 | 0:d2e117716219 | 10 | #ifndef THREAD_FLAG_H_ |
altb2 | 0:d2e117716219 | 11 | #define THREAD_FLAG_H_ |
altb2 | 0:d2e117716219 | 12 | |
altb2 | 0:d2e117716219 | 13 | #include <cstdlib> |
altb2 | 0:d2e117716219 | 14 | #include <stdint.h> |
altb2 | 0:d2e117716219 | 15 | #include <mbed.h> |
altb2 | 0:d2e117716219 | 16 | |
altb2 | 0:d2e117716219 | 17 | /** |
altb2 | 0:d2e117716219 | 18 | * This class manages the handling of unique thread flags to trigger rtos threads. |
altb2 | 0:d2e117716219 | 19 | */ |
altb2 | 0:d2e117716219 | 20 | class ThreadFlag { |
altb2 | 0:d2e117716219 | 21 | |
altb2 | 0:d2e117716219 | 22 | public: |
altb2 | 0:d2e117716219 | 23 | |
altb2 | 0:d2e117716219 | 24 | ThreadFlag(); |
altb2 | 0:d2e117716219 | 25 | virtual ~ThreadFlag(); |
altb2 | 0:d2e117716219 | 26 | virtual uint32_t read(); |
altb2 | 0:d2e117716219 | 27 | operator uint32_t(); |
altb2 | 0:d2e117716219 | 28 | |
altb2 | 0:d2e117716219 | 29 | private: |
altb2 | 0:d2e117716219 | 30 | |
altb2 | 0:d2e117716219 | 31 | static uint32_t threadFlags; // variable that holds all assigned thread flags |
altb2 | 0:d2e117716219 | 32 | uint32_t threadFlag; // thread flag of this object |
altb2 | 0:d2e117716219 | 33 | Mutex mutex; // mutex to lock critical sections |
altb2 | 0:d2e117716219 | 34 | }; |
altb2 | 0:d2e117716219 | 35 | |
altb2 | 0:d2e117716219 | 36 | #endif /* THREAD_FLAG_H_ */ |
altb2 | 0:d2e117716219 | 37 |