Introduce a new function, __task_get_current_owner, that returns the
owner of a task based on its current tid.
-1 means there is no current owner, otherwise either the tid is >= 0, in
which case it will just return it, or it's < -1, in which case it will
return -2 - tid, the tid of the thread with the current ownership.
return -2 - tid;
}
+static inline int __task_get_current_owner(int curtid)
+{
+ if (curtid >= 0 || curtid == -1)
+ return curtid;
+ return ~(curtid + 1);
+}
+
/* puts the task <t> in run queue with reason flags <f>, and returns <t> */
/* This will put the task in the local runqueue if the task is only runnable
* by the current thread, in the global runqueue otherwies. With DEBUG_TASK,