Skip to content
Snippets Groups Projects
Commit ac6b9e4e authored by Amber-Sophia Schröck's avatar Amber-Sophia Schröck
Browse files

rename *sleep to mn_*sleep

parent 106faa8f
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,8 @@ public:
basic_task() : mthread("basic_task", 5, 2048) { }
virtual void* on_thread() {
mthread::on_thread();
int id = get_id();
int core = get_on_core();
......@@ -25,7 +27,7 @@ extern "C" void app_main() {
printf("Thank you for using libmnthread version: %s\n",
libmn_version.to_string().c_str());
sleep(3);
mn_sleep(3);
basic_task basic_task;
basic_task.create(TASk_ON_CPU);
......
......@@ -6,6 +6,8 @@ public:
helloWorld_task() : mthread("hello_task", 5, 2048) { k = 0;}
virtual void* on_thread() {
mthread::on_thread();
int id = get_id();
int core = get_on_core();
......@@ -24,7 +26,7 @@ extern "C" void app_main() {
printf("Thank you for using libmnthread version: %s\n",
libmn_version.to_string().c_str());
sleep(3);
mn_sleep(3);
helloWorld_task __test[10];
for(int i=0; i < 10; i++) {
__test[i].create(i % 2);
......
......@@ -16,16 +16,16 @@
unsigned sleep(unsigned int secs) {
unsigned mn_sleep(unsigned int secs) {
vTaskDelay( (secs * 1000) / ((TickType_t) 1000 / configTICK_RATE_HZ));
return 0;
}
int usleep(useconds_t usec) {
int mn_usleep(useconds_t usec) {
vTaskDelay(usec / ((TickType_t) 1000000 / configTICK_RATE_HZ));
return 0;
}
int IRAM_ATTR nsleep(const struct timespec *req, struct timespec *rem) {
int IRAM_ATTR mn_nsleep(const struct timespec *req, struct timespec *rem) {
struct timeval start, end;
if ((req->tv_nsec < 0) || (req->tv_nsec > 999999999)) {
......
......@@ -11,9 +11,9 @@
#include <sys/signal.h>
unsigned sleep(unsigned int secs);
int usleep(useconds_t usec);
unsigned mn_sleep(unsigned int secs);
int mn_usleep(useconds_t usec);
int nsleep(const struct timespec *req, struct timespec *rem);
int mn_nsleep(const struct timespec *req, struct timespec *rem);
#endif
......@@ -182,7 +182,9 @@ void basic_thread::runtaskstub(void* parm) {
esp_thread->m_runningMutex->unlock();
}
void basic_thread::thread_started() {
m_continuemutex2->unlock();
}
uint32_t __internal_id_base__ = 0;
uint32_t basic_thread::get_new_id() {
......
......@@ -27,7 +27,6 @@ public:
int create(int uiCore = -1);
int kill();
bool is_running();
const char* get_name();
......@@ -44,7 +43,7 @@ public:
void suspend();
void resume();
virtual void* on_thread() { return NULL; }
virtual void* on_thread() { thread_started(); return NULL; }
basic_thread* get_root();
basic_thread* get_child();
......@@ -54,16 +53,17 @@ public:
static void suspend(basic_thread *t) { t->suspend(); }
static void resume(basic_thread *t) { t->resume(); }
static void yield() { taskYIELD(); }
static void sleep(unsigned int secs) { ::sleep(secs); }
static void usleep(unsigned int usec) { ::usleep(usec); }
static void sleep(unsigned int secs) { ::mn_sleep(secs); }
static void usleep(unsigned int usec) { ::mn_usleep(usec); }
static void nsleep(const struct timespec *req, struct timespec *rem) {
::nsleep(req, rem);
::mn_nsleep(req, rem);
}
static void lock(basic_thread * t) { t->m_runningMutex->lock(); }
static void unlock(basic_thread * t) { t->m_runningMutex->unlock(); }
protected:
static void runtaskstub(void* parm);
void thread_started();
private:
static uint32_t get_new_id();
protected:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment