Re: How to do proper locking

From: Ian Dowse (iedowse_at_iedowse.com)
Date: 08/06/05

  • Next message: Mike Silbersack: "Re: Kernel code of reseting/ignoring tcp SYN packets"
    To: hselasky@c2i.net
    Date: Sat, 06 Aug 2005 17:02:16 +0100
    
    

    In message <200508060139.57143.hselasky@c2i.net>, Hans Petter Selasky writes:
    >Yes, you are right, but the problem is, that for most callback systems in the
    >kernel, there is no mechanism that will pre-lock some custom mutex before
    >calling the callback.
    >
    >I am not speaking about adding lines to existing code, but to add one extra
    >parameter to the setup functions, where the mutex that should be locked
    >before calling the callback(s) can be specified. If it is NULL, Giant will be
    >used.
    >
    >The setup functions I have in mind are for example: "make_dev()",
    >"bus_setup_intr()", "callout_reset()" ... and in general all callback systems
    >that look like these.

    Note that FreeBSD's callout subsystem does already have such a
    mechanism. Just use callout_init_mtx() and the specified mutex will
    be acquired before the callback is invoked. See callout(9) for more
    details.

    Ian
    _______________________________________________
    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: Mike Silbersack: "Re: Kernel code of reseting/ignoring tcp SYN packets"

    Relevant Pages

    • Simple thread logic problem
      ... the callback is canceled and the object ... void Foo::CancelProcess ... CancelProcess() will cancel the pending callback. ... CancelProcessgets the mutex, it's an error - the mutex will be ...
      (comp.programming.threads)
    • RE: Callbacks from unmanaged code...
      ... the calling convention for methods is StdCall. ... which will cause problems in your managed callback. ... calls some of our older software, located in a DLL. ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: confusion regarding threading
      ... Yes calling Any 'beginAsync' method creates a new thread to execute on. ... In thread procedure i am processing some URL's asynchronously. ... calling beginwebrequest for procesing 5 urls at a time. ... Secondly in beginwebrequest i am passing one callback fuction whcih ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: Idea
      ... >> happily storing and calling callback functions long before OO ... method pointer with the context object set to nil, ... declare any classes to add an event handler method to, ...
      (comp.lang.pascal.delphi.misc)
    • Re: [Question] inotify : process based filtering of events
      ... which, when used, will only collect events for the calling ... With nested attributes patch you can add your own callback which will ... smaller amount of work than extending inotify with new flag and redoing ...
      (Linux-Kernel)