Re: Kernel crash w/o reason

From: John Baldwin (jhb_at_FreeBSD.org)
Date: 12/27/04

  • Next message: security_at_revolutionsp.com: "Supported wireless PCI card?"
    To: freebsd-hackers@FreeBSD.org
    Date: Mon, 27 Dec 2004 15:38:11 -0500
    
    

    On Friday 24 December 2004 07:13 am, Jan Engelhardt wrote:
    > >> What should I use instead? A semaphore?
    > >
    > >You shouldn't have unrelated kernel threads waiting for a user
    > >process at all, so this sounds like a design problem, regardless
    > >of which mutual exclusion primitive you use. (Bear in mind that I
    > >haven't actually looked into what you're trying to do.) In any
    > >case, you can always use mutexes to implement whatever other
    > >synchronization mechanism you need.
    >
    > I wanted that the device can only be opened once, and holding a mutex while
    > it is open seemed like a simple idea. (Since mtx_trylock() will then fail
    > -- easy to implement.)

    Use a flag in your softc and use a mutex to protect access to the flag.

    -- 
    John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
    "Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
    

  • Next message: security_at_revolutionsp.com: "Supported wireless PCI card?"

    Relevant Pages

    • Re: temporary disable thread switching using pthreads
      ... which prevents the scheduler from scheduling ... protect this flag. ... If a resource is protected by a mutex, ...
      (comp.programming.threads)
    • Re: How to avoid DCLP?
      ... Another processor will still call func() first, then set flag, ... InterlockedExchange to set flag, and *fairly* safely assume that the ... the simple mutex version might be the tried/testet/true approach. ...
      (comp.programming.threads)
    • Re: OnlyOne Instance
      ... It is more flexible than a mutex, ... John Leavey wrote: ... >>You reset the flag in the OnClose event. ... >>the flag, and to save the MemIniFile to the hard disk. ...
      (borland.public.delphi.language.objectpascal)
    • Re: X & securelevel=3
      ... I've revived the Apature kernel patch for the 4-Stable kernels ... and put a flag in for mutex under 5-Stable, but have not and will not test that ... The Xorg package does support it with the right flag switched on.. ... Anna ...
      (FreeBSD-Security)