> This would work assuming I can freely replace __spin_lock and > __spin_unlock glibc functions by pthread_spin_lock and > pthread_spin_unlock, and they are compatible.
You can. > /* Just like pthread_condition_wait, but cancellable. Returns true if > cancelled. */ > int > hurd_pthread_cond_wait (pthread_cond_t c, pthread_mutex_t m) I see no reason to rename this function. Also, this should be: hurd_cond_wait (pthread_cond_t *c, pthread_mutex_t *m) > { > /* This function will be called by hurd_thread_cancel while we > are blocked in the pthread_cond_wait. We wake up all threads blocked > on C,so our thread will wake up and notice the cancellation flag. > */ Please follow the GNU coding standards. This is not the only error. > else > { > /* Now unlock the mutex and block until woken. */ > pthread_mutex_unlock (m); > pthread_cond_wait(c, m); Wrong. pthread_mutex_unlock takes a locked mutex. > I think there is a race condition in this implementation. > After setting the hook function and unlocking ss->lock, we can receive > a signal broadcast before we have done a pthread_cond_wait. That is okay. Remember, we are just queuing a message so it will be there when we do the actual wait. > c) A different implementation using __pthread_enqueue function. This should be done anyways. > At the end there is the original hurd_condition_wait function > attached. Unless you completely rewrite something, diffs are much more useful. _______________________________________________ Bug-hurd mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-hurd