AP_HAL_Linux: add method to check caller same as thread

This commit is contained in:
Lucas De Marchi 2016-02-03 02:12:23 -02:00
parent e3beef0f77
commit 0282ebb8ff
2 changed files with 7 additions and 0 deletions

View File

@ -91,4 +91,9 @@ bool Thread::start(const char *name, int policy, int prio)
return true; return true;
} }
bool Thread::is_current_thread()
{
return pthread_equal(pthread_self(), _ctx);
}
} }

View File

@ -40,6 +40,8 @@ public:
bool start(const char *name, int policy, int prio); bool start(const char *name, int policy, int prio);
bool is_current_thread();
protected: protected:
static void *_run_trampoline(void *arg); static void *_run_trampoline(void *arg);