unlocking mutex from another thread

Hi,

is there any possibility in QNX to unlock a mutex from another thread?

setting the process shared attribute to PTHREAD_PROCESS_SHARED seems also not to be the solution.

By another thread, do you mean another thread in another process or another thread in the same process?

it is a thread in the same process. is it possible?

or is there anyway to manipulate a thread ID so the other thread which is supposed to unlock the mutex has the same thread ID with the one locking it?

Lbdgwgt,

I doubt there is any way to spoof thread id’s. That would be a big security hole not to mention a major source of confusion if an interrupt was attached to a thread and you spoofed it and the interrupt fired because the O/S wouldn’t know which thread to activate.

I have to ask why you want to unlock a mutex held by thread A from thread B. That might shed some light on a possible solutions.

Tim

Hi Tim,

thanks for the reply. we are implementing actually a “switch” application which has to control the accesses from multiple users, but the sending and receiving process are triggered by different threads. So the first idea is to protect the switch with a mutex which is locked by sending thread and then released by the receiving thread.

But it’s ok, i think we have come up with another solution using the condition variable to avoid this problem of locking/unlocking mutex from different threads.