2014-08-13 12:21 GMT-05:00 Grant Edwards <grant.b.edwa...@gmail.com>: > This is not Gentoo specific, and while I'm doing my prototyping and > development on a Gentoo system, the eventual target is not going to be > running Gentoo -- so feel free to ignore this thread or throw things > at me.
You're close enough ;) I'll try to answer to the best of my ability, which is admittedly not much. > I'm trying to figure out how to synchronize threads which may be in > different processes. Basically, I want thread A to be able to wake up > any number of other threads B, C, D, ... who are all blocking until A > says "go" (and who may or may not be in other processes). Without knowing what you're doing, this sounds like a bad idea; if you *need* to synchronize threads, why aren't they running in the same process? If it's going to be running on Linux, you can send signals through the kernel's signal API; specifically HUP, USR1, and USR2 might be of interest to you. > A condition variable in shared memory is the closest thing I have > found, and my test applications are working OK (so far). But, I'm > unclear on the purpose of the mutex whose address you pass to > pthread_cond_wait(). I'm too much of a rookie to know how to do this; how are you sharing memory between processes? > The mutex appears to be there to serialize access to some user-defined > variable(s) (outside the condition variable itself) which I don't > have. So all the mutex locking/unlocking and resultant blocking of B, > C, D is just wasted overhead and pointless latency. This is definitely not a task for mutexes, a boolean or signaling would work much better. I'm not sure what exactly you're trying to do, but I hope this helps. If you can be more specific about the relationships between processes, I might be able to help more. Alec