开发者

Can I mix futex-based mutexes with glibc-2.2 linuxthreads mutexes?

If you don't know what is futex and linuxthreads-0.9, please, don't reply.

Can I mix in one program futex-based mutex with mutex from linuxthreads-0.8 or -0.9 (which was used in all glibc <=2.2 and in all uClibc) ?

I need interprocess mutex (pshared one, PTHREAD_PROCESS_SHARED).

So, If threads are started and managed by linuxthreads p开发者_开发技巧thread_manager, will it be confused by futex-based sleep and wake?

Can I use futex-based mutexes both for inter-process and inter-thread synchronization?


I don't see why you couldn't.

You will not be able to use pthreads, obviously. You will probably be using the pthread library with the old mutexes and you will need to have the futex code in some other library.

You obviously cannot lock a linuxthreads mutex and unlock it with a futex function, that would never work.

But if one thread is blocked in the kernel waiting on a futex, I do not see how it's any different than being blocked on a disk I/O operation, and linuxthreads handles that well enough.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜