condvar and mutexes

From: Nicolas Souchu (nsouch_at_free.fr)
Date: 06/26/04

  • Next message: Robert Watson: "Re: condvar and mutexes"
    Date: Sat, 26 Jun 2004 23:42:19 +0200
    To: freebsd-arch@freebsd.org
    
    

    Why is condvar(9) API not part of the mutex(9) one? A condvar is
    nothing more than a mutex with a queue of waiting threads.

    I would simply imagine some wait calls applied to mutexes
    with the queue in the mutex struct.

    Nicholas

    -- 
    Nicholas Souchu - nsouch@free.fr - nsouch@FreeBSD.org
    http://www.freebsd.org/~nsouch/kgi4BSD
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
    

  • Next message: Robert Watson: "Re: condvar and mutexes"

    Relevant Pages

    • Re: Recursive mutex that can be waited upon (pthread)
      ... While you can use a mutex to avoid that data is changed, for me having a mutex does not mean that data is not changed, it only means that data is not changed by a different thread. ... My own thread may of course change the data, hence functions I call may want to change the data and if they do so, they must be sure that these changes are atomically, hence they must lock the object and they simply can't rely that I locked the object before -> thus I need recursive locks. ... Then I could as well throw out threads of my code and just use a single thread going through an event queue. ... you have a predicate condition on an invariant. ...
      (comp.programming.threads)
    • Re: IOCP critical sections and mutexes
      ... those are pulled from the queue via GetQueuedCompletionStatus ... BTW, for the record, both the user mode accessible mutex and critical ... My packets never go over 2k in size. ... then pushes it in a queue that will be later processed by my main app ...
      (microsoft.public.win32.programmer.kernel)
    • Re: Multithreaded queue with wait event
      ... if two threads release the mutex and are just about to ... See, if that happens, one thread will receive the event and dequeue. ... your queue can indeed return no item when there is no timeout ... I have two implementations, one using the semaphore, the other using ...
      (comp.programming.threads)
    • Thread starvation with pthreads in Linux?
      ... I ran into a strange situation using pthreads in Linux 2.6. ... To implement this, I used a single mutex, along with a bitmap. ... Everytime a thread wanted access to a particular queue, ... actually executed in a multi-threaded environment. ...
      (comp.unix.programmer)
    • Re: Queue question
      ... > like for the Lock instance named 'mutex', they can be used in subclasses ... Queue instance variables as Guido put into them originally: ... of the former `esema` and `fsema` attributes. ...
      (comp.lang.python)