Demo program for mbed 5 thread start compile rerror
Fork of mbed-os-example-mbed5-blinky by
Revision 17:267747192719, committed 2016-11-03
- Comitter:
- Roietronics
- Date:
- Thu Nov 03 09:19:33 2016 +0000
- Parent:
- 16:71f51c703eee
- Child:
- 18:7f2d0c1cfb33
- Commit message:
- Thead Bug demo
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed-os.lib | Show annotated file Show diff for this revision Revisions of this file |
--- 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);
--- a/mbed-os.lib Fri Oct 28 13:15:03 2016 +0100 +++ b/mbed-os.lib Thu Nov 03 09:19:33 2016 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#e2617cc0e17f5c3fc2bae6a589c9bcfd3d1a717b +https://github.com/ARMmbed/mbed-os/#a6f3fd1a60d5df59246d7caf3f108c4d34e1808e
