Demo program for mbed 5 thread start compile rerror
Fork of mbed-os-example-mbed5-blinky by
Diff: main.cpp
- Revision:
- 17:267747192719
- Parent:
- 8:bb09890333fe
- Child:
- 18:7f2d0c1cfb33
--- a/main.cpp Fri Oct 28 13:15:03 2016 +0100 +++ b/main.cpp Thu Nov 03 09:19:33 2016 +0000 @@ -1,10 +1,37 @@ #include "mbed.h" +#include "Thread.h" DigitalOut led1(LED1); +#define mySignal 0x01 +class Test +{ + public: + osThreadId _id; + Thread _thread; + + void myWorker(void* arge) + { + int i; + i++; + osSignalSet(_id, mySignal); + + } + + Test(osThreadId id) : + _id(id), + _thread() + { + _thread.start(this, &Test::myWorker); + } + +}; + // main() runs in its own thread in the OS // (note the calls to Thread::wait below for delays) int main() { + osThreadId id = Thread::gettid(); + Test* test = new Test(id); while (true) { led1 = !led1; Thread::wait(500);