mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-03 02:41:08 +00:00
Protect task->refcount by tasks lock
This commit is contained in:
parent
a5b01f34ab
commit
77d80106e6
@ -231,17 +231,23 @@ R_API void r_core_task_incref (RCoreTask *task) {
|
||||
if (!task) {
|
||||
return;
|
||||
}
|
||||
TASK_SIGSET_T old_sigset;
|
||||
tasks_lock_enter (task->core, &old_sigset);
|
||||
task->refcount++;
|
||||
tasks_lock_leave (task->core, &old_sigset);
|
||||
}
|
||||
|
||||
R_API void r_core_task_decref (RCoreTask *task) {
|
||||
if (!task) {
|
||||
return;
|
||||
}
|
||||
TASK_SIGSET_T old_sigset;
|
||||
tasks_lock_enter (task->core, &old_sigset);
|
||||
task->refcount--;
|
||||
if (task->refcount <= 0) {
|
||||
task_free (task);
|
||||
}
|
||||
tasks_lock_leave (task->core, &old_sigset);
|
||||
}
|
||||
|
||||
R_API void r_core_task_schedule(RCoreTask *current, RTaskState next_state) {
|
||||
|
Loading…
Reference in New Issue
Block a user