[lttng-dev] urcu rfc: privatize urcu/futex.h

Lai Jiangshan laijs at cn.fujitsu.com
Tue Aug 7 05:12:31 EDT 2012


futex.h is in urcu/, it means it can be used by users out of the library.

But

If the user's system has futex, he should use #include <linux/futex.h>.
If the user's system don't have futex, it is not good that if the user use this compat_futex.

Because the compat_futex_async()'s behavior is different from the futex in linux.
If the caller don't change the value of @uaddr, the futex(FUTEX_WAKE) in linux can
also wake a thread, but compat_futex_async() don't.
(I guess no one use this behavior, but if there are someone, we give them a wrong thing)

So I suggest urcu/futex.h becomes a private thing for urcu.

Alternative implements(only describe the alternative FUTEX_WAIT):
1) Like compat_futex_noasync(), but use mutex_lock_signal_save() + pthread_cond_wait().
Problem: the thread can't handle the signal when waiting on pthread_cond_wait().
(* mutex_lock_signal_save() is implemented in compat_arch_x86.c)

2) Like the linux kernel, use use mutex_lock_signal_save() + hash table
	+ sleeping (use poll() + restore signal mask)
Problem: very complex

Thanks,
Lai.

(today I found a old patchset in my private tree, tried to rebase it and suddenly notice
this urcu/futex.h but the patchset has nothing related with urcu/futex.h).



More information about the lttng-dev mailing list