Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsyncWrap external API improvements #3461

Merged
merged 3 commits into from
Nov 6, 2015

Commits on Nov 6, 2015

  1. async_wrap: allow some hooks to be optional

    Only enforce that the init callback is passed to setupHooks(). The
    remaining hooks can be optionally passed.
    
    Throw if async_wrap.enable() runs before setting the init callback or if
    setupHooks() is called while async wrap is enabled.
    
    Add test to verify calls throw appropriately.
    
    PR-URL: nodejs#3461
    Reviewed-By: Fedor Indutny <fedor@indutny.com>
    trevnorris committed Nov 6, 2015
    Configuration menu
    Copy the full SHA
    a4e9487 View commit details
    Browse the repository at this point in the history
  2. async_wrap: new instances get uid

    New instances of AsyncWrap are automatically assigned a unique id. The
    value will be used in future commits to communicate additional
    information via the async hooks.
    
    While the largest value we can reliably communicate to JS is 2^53, even
    if a new AsyncWrap is created every 100ns the uid won't reach its end
    for 28.5 years.
    
    PR-URL: nodejs#3461
    Reviewed-By: Fedor Indutny <fedor@indutny.com>
    trevnorris committed Nov 6, 2015
    Configuration menu
    Copy the full SHA
    80a66ba View commit details
    Browse the repository at this point in the history
  3. async_wrap: call callback in destructor

    Call a user's callback to notify that the handle has been destroyed.
    Only pass the id of the AsyncWrap instance since the object no longer
    exists.
    
    The object that's being destructed should never be inspected within the
    callback or any time afterward.
    
    This commit make a breaking change. The init callback will now be passed
    arguments in the order of provider, id, parent.
    
    PR-URL: nodejs#3461
    Reviewed-By: Fedor Indutny <fedor@indutny.com>
    trevnorris committed Nov 6, 2015
    Configuration menu
    Copy the full SHA
    bb1bd76 View commit details
    Browse the repository at this point in the history