mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
process to asinc
This commit is contained in:
30
src/Class/NotAsinc.cpp
Normal file
30
src/Class/NotAsinc.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "Class/NotAsinc.h"
|
||||
|
||||
NotAsinc::NotAsinc(uint8_t size) {
|
||||
this->items = new NotAsincItem[size];
|
||||
this->size = size;
|
||||
}
|
||||
|
||||
NotAsinc::~NotAsinc() {}
|
||||
|
||||
void NotAsinc::add(uint8_t i, NotAsincCb f, void* arg) {
|
||||
this->items[i].cb = f;
|
||||
this->items[i].cb_arg = arg;
|
||||
this->items[i].is_used = true;
|
||||
}
|
||||
|
||||
void NotAsinc::loop() {
|
||||
if (this->items[task].is_used) {
|
||||
handle(this->items[task].cb, this->items[task].cb_arg);
|
||||
task = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void NotAsinc::make(uint8_t task) {
|
||||
this->task = task;
|
||||
}
|
||||
|
||||
void NotAsinc::handle(NotAsincCb f, void* arg) {
|
||||
f(arg);
|
||||
}
|
||||
NotAsinc* myNotAsincActions;
|
||||
Reference in New Issue
Block a user