mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-03 17:10:35 +08:00
drv_hrt: fix TSAN issues
This commit is contained in:
@@ -134,7 +134,10 @@ void hrt_store_absolute_time(volatile hrt_abstime *t)
|
||||
*/
|
||||
bool hrt_called(struct hrt_call *entry)
|
||||
{
|
||||
return (entry->deadline == 0);
|
||||
hrt_lock();
|
||||
bool result = (entry->deadline == 0);
|
||||
hrt_unlock();
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -416,12 +419,15 @@ hrt_call_invoke()
|
||||
call->deadline = 0;
|
||||
|
||||
/* invoke the callout (if there is one) */
|
||||
if (call->callout) {
|
||||
hrt_callout callout = call->callout;
|
||||
void *arg = call->arg;
|
||||
|
||||
if (callout) {
|
||||
// Unlock so we don't deadlock in callback
|
||||
hrt_unlock();
|
||||
|
||||
//PX4_INFO("call %p: %p(%p)", call, call->callout, call->arg);
|
||||
call->callout(call->arg);
|
||||
//PX4_INFO("call %p: %p(%p)", call, callout, arg);
|
||||
callout(arg);
|
||||
|
||||
hrt_lock();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user