-
Quick mutex question
Compiler: GCC 2.95.4
Platform: Debian
Thread Library: pth from GNU
Ok say I have a struct such as
Code:
struct blah {
int x;
int y;
int c;
/* blah blah blah */
pth_mutex_t lock;
};
and I lock it with
Code:
struct blah blahblah;
pth_acquire(&blahblah.lock, 0, NULL);
Does it lock the entire structure? If not how do I lock the entire thing?
At the time of this posting gnu.org is down so I'm not able to look there and the man page doesn't seem to explain it clearly.
Thanks
-
Oh I think I might be misunderstanding it. The commands don't lock it per se but acts like a check point. So if its not open the thread waits till it is then you know its safe to change the data.
Is this mostly correct?