You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
712 B
24 lines
712 B
#include "zos_thread.hpp"
|
|
#include "zoslogger.hpp"
|
|
using namespace iflytop;
|
|
using namespace std;
|
|
|
|
static void zosthread_default_task(void const *argument) {
|
|
ZOSThread *thread = (ZOSThread *)argument;
|
|
thread->__callfunc();
|
|
}
|
|
|
|
void ZOSThread::init(const char *threadname, int stack_size, osPriority priority) {
|
|
_stack_size = stack_size;
|
|
_priority = priority;
|
|
_threadname = threadname;
|
|
}
|
|
|
|
void ZOSThread::run(function<void()> func) {
|
|
_func = func;
|
|
osThreadDef(zosthread_default_task, zosthread_default_task, _priority, 0, _stack_size);
|
|
_defaultTaskHandle = osThreadCreate(osThread(zosthread_default_task), this);
|
|
ZASSERT(_defaultTaskHandle != NULL);
|
|
}
|
|
|
|
void ZOSThread::__callfunc() { _func(); }
|