pid_t caller_tid;
struct list_head *list, *other_list;
struct list_head call_list;
+ static pid_t waiting_tid = 0;
tdm_error ret;
TDM_RETURN_VAL_IF_FAIL(TDM_MUTEX_IS_LOCKED(), TDM_ERROR_OPERATION_FAILED);
assert(LIST_IS_EMPTY(&call_list));
- LIST_FOR_EACH_ENTRY_SAFE(cb, hh, other_list, link) {
- if (cb->object != object ||
- cb->cb_type != cb_base->type ||
- cb->cb_data != cb_base->data)
- continue;
+ if (waiting_tid == 0) {
+ LIST_FOR_EACH_ENTRY_SAFE(cb, hh, other_list, link) {
+ if (cb->object != object ||
+ cb->cb_type != cb_base->type ||
+ cb->cb_data != cb_base->data)
+ continue;
- handler_in_other_thread = 1;
- break;
+ handler_in_other_thread = 1;
+ break;
+ }
}
if (!handler_in_other_thread) {
if (keep_private_thread) {
if (cb_base->sync) {
+ waiting_tid = 0;
pthread_cond_signal(&keep_private_thread->event_cond);
if (tdm_debug_module & TDM_DEBUG_THREAD)
TDM_INFO("pthread broadcase");
* the mutex shall have been locked and shall be owned by the calling thread
*/
tdm_mutex_locked = 0;
+ waiting_tid = caller_tid;
pthread_cond_wait(&keep_private_thread->event_cond, &private_display->lock);
tdm_mutex_locked = 1;
}