Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
MyThread.cpp
- Committer:
- clemounet
- Date:
- 2015-04-14
- Revision:
- 4:eef83534b19e
- Parent:
- 2:6cc4c56940af
File content as of revision 4:eef83534b19e:
#include "MyThread.h" #include "MyLibc.h" #define __DEBUG__ 0 #ifndef __MODULE__ #define __MODULE__ "MyThread.cpp" #endif #include "MyDebug.h" void MainTrampoline(void const *args){ MyThread *mt = (MyThread*) args; mt->Main(); mt->t->signal_set(ENDSIG); mt->t->terminate(); } MyThread::MyThread(const char* name,uint32_t sz){ stackSize = sz; tName = strdup(name); } MyThread::~MyThread() { free((char*)tName); } void MyThread::Start(void){ running = true; } void MyThread::Stop(void){ running = false; } void MyThread::Run(void){ t = new Thread(MainTrampoline,this,osPriorityNormal,stackSize); } void MyThread::Wait(int32_t ms){ t->wait(ms); } void MyThread::WaitEnd(){ t->signal_wait(ENDSIG); }