Thread: Quick mutex question

  1. #1
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681

    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

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    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?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Very quick math question
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 10-26-2005, 11:05 PM
  2. very quick question.
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 07-24-2002, 03:48 AM
  3. quick question
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-22-2002, 04:44 AM
  4. Quick Question Regarding Pointers
    By charash in forum C++ Programming
    Replies: 4
    Last Post: 05-04-2002, 11:04 AM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM