Re: WaitForSingleObject() will not deadlock



Won't work. If you try to lock an object, and fail, then you can't legitimately tell if
you are the thread that originally locked it, or some other thread has it locked, so you
can't tell the validity of the has-been-visited flag, so it requires that you would pass
the entire locking sequence around so that if a try failed, you have to inspect the record
of all outstanding locks in the thread to see if there is an instance of the lock already
present. This means you have to deal with potentially unbounded sequences of locks in a
data structure, not a pleasant prospect.
joe

On Sun, 01 Jul 2007 23:43:56 -0700, Frank Cusack <fcusack@xxxxxxxxxxx> wrote:

On Mon, 02 Jul 2007 01:44:06 -0400 Joseph M. Newcomer <newcomer@xxxxxxxxxxxx> wrote:
But the issue is how can you lock and traverse a potentially
circular list with "node has been visited" detection without a
recursive mutex?

pthread_mutex_trylock()? or equivalent.
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Securing SSH
    ... and if you manage to slam that second door in haste.... ... in my ability to lock my keys in the car twice in succession. ... Where safe matters I try to fail safe. ... I'm looking to tighten up my ssh configuration. ...
    (Fedora)
  • Re: Reprise: in out parameters for functions
    ... > relational database is organized as one large B* tree. ... one lock per storage pool. ... the data structure controls the data structure and a separate per object ... the tree or whatever with a pointer designating ...
    (comp.lang.ada)
  • Re: workqueue deadlock
    ... but it is still preemptible and the lock is specific. ... preempt_disableis the preferred way of holding off cpu hotplug. ... already (and can be programmatically attached to the data structure ... "CPU hotplug code" is the implementation of that data structure, ...
    (Linux-Kernel)
  • Re: how to read dynamic data structures from the kernel (was Re: reading routing table)
    ... could give us individual entries of the data structure on each call, ... steps for any given kernel subsystem -- we have data structures, ... bumping the references and adding pointers to the array. ... the global locks, and proceed lock, externalize, unlock, and copyout each ...
    (freebsd-net)
  • [RFC][PATCH] a revised job patch (with jobfs)
    ... To Chris Wright: ... > Why not simply lock the table in here? ... And, jobfs_create can fail. ... > This is and odd interface. ...
    (Linux-Kernel)

Loading