0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
Commit Graph

29 Commits

Author SHA1 Message Date
Timothy J Fontaine
cd6122edeb add ref/unref to setTimeout timers 2012-07-23 18:31:30 +02:00
isaacs
424cd5a020 Merge remote-tracking branch 'ry/v0.8' into v0.8-merge
Conflicts:
	src/node_version.h
2012-07-11 17:38:11 -07:00
Shigeki Ohtsu
76104f3414 timer: change new Date to Date.now for performance
Speeds up benchmark/settimeout.js by about 30%.
2012-07-10 22:44:07 +02:00
Ben Noordhuis
0c47219a72 timers: fix handling of large timeouts
Don't use the double-negate trick to coalesce the timeout argument into a
number, it produces the wrong result for very large timeouts.

Example:

    setTimeout(cb, 1e10); // doesn't work, ~~1e10 == 1410065408
2012-07-05 23:07:27 +02:00
isaacs
963459d736 Domain feature
This is a squashed commit of the main work done on the domains-wip branch.

The original commit messages are preserved for posterity:

* Implicitly add EventEmitters to active domain
* Implicitly add timers to active domain
* domain: add members, remove ctor cb
* Don't hijack bound callbacks for Domain error events
* Add dispose method
* Add domain.remove(ee) method
* A test of multiple domains in process at once
* Put the active domain on the process object
* Only intercept error arg if explicitly requested
* Typo
* Don't auto-add new domains to the current domain

    While an automatic parent/child relationship is sort of neat,
    and leads to some nice error-bubbling characteristics, it also
    results in keeping a reference to every EE and timer created,
    unless domains are explicitly disposed of.

* Explicitly adding one domain to another is still fine, of course.
* Don't allow circular domain->domain memberships
* Disposing of a domain removes it from its parent
* Domain disposal turns functions into no-ops
* More documentation of domains
* More thorough dispose() semantics
* An example using domains in an HTTP server
* Don't handle errors on a disposed domain
* Need to push, even if the same domain is entered multiple times
* Array.push is too slow for the EE Ctor
* lint domain
* domain: docs
* Also call abort and destroySoon to clean up event emitters
* domain: Wrap destroy methods in a try/catch
* Attach tick callbacks to active domain
* domain: Only implicitly bind timers, not explicitly
* domain: Don't fire timers when disposed.
* domain: Simplify naming so that MakeCallback works on Timers
* Add setInterval and nextTick to domain test
* domain: Make stack private
2012-04-17 13:14:55 -07:00
Ben Noordhuis
7fc835afe3 timers: handle negative or non-numeric timeout values
Follows browser behaviour by scheduling the callback on the next tick.

Fixes #593.
2012-03-15 13:56:30 -07:00
Ben Noordhuis
b221fe9b29 timers: add v0.4 compatibility hack
If a timer callback throws and the user's uncaughtException handler ignores the
exception, other timers that expire on the current tick should still run.

If #2582 goes through, this hack should be removed.

Fixes #2631.
2012-01-30 14:12:23 +01:00
Ben Noordhuis
d8c178bc16 timers: fix performance regression
Fix a 5-7% performance regression in the http_simple benchmark that was
introduced by the following commits:

  348d8cd timers: remove _idleTimeout from item in .unenroll()
  f2f3028 timers: fix memory leak in setTimeout
  098fef6 timers: remember extra setTimeout() arguments when timeout==0

Fix suggested by Bert Belder.
2011-12-22 14:42:25 +01:00
James Hartig
348d8cd04a timers: remove _idleTimeout from item in .unenroll()
Stops .active() from reactivating the timer.

Fixes #2114.
2011-12-20 00:57:15 +01:00
Yoshihiro Kikuchi
f2f30286bf timers: fix memory leak in setTimeout
Closing handle is leaked when setTimeout called with arguments which are
1. a callback
2. zero delay
(i.e. setTimeout(function(){}, 0); )
2011-12-18 01:50:01 +01:00
Ben Noordhuis
098fef6740 timers: remember extra setTimeout() arguments when timeout==0
Fixes #2079.
2011-11-12 13:31:28 +01:00
Ryan Dahl
be0bb2dc13 Remove net_legacy timers_legacy 2011-10-11 13:11:54 -07:00
Ryan Dahl
d005cc5cc9 Enable new timer binding only on --use-uv 2011-06-29 15:14:55 +02:00
Bert Belder
d9aa9b54cf Use timer_wrap instead of the old timer binding 2011-06-08 05:06:13 +02:00
Ryan Dahl
55048cdf79 Update copyright headers 2011-03-14 17:37:05 -07:00
Ryan Dahl
1a7830a92a Fix debug flag in timers.js 2011-02-04 09:00:21 -08:00
Ryan Dahl
bfb6a67d60 Another fix for process.assert 2011-01-27 16:59:28 -08:00
Ryan Dahl
2ec4cd5525 factor linklist code into own file 2011-01-18 14:26:32 -08:00
Ryan Dahl
29f48d48e5 A few more list clean ups 2011-01-13 02:22:09 -08:00
Ryan Dahl
09994438e5 Expose link-list from timers.js; add tests 2011-01-13 02:10:09 -08:00
Ryan Dahl
86160a8807 NODE_DEBUG=timer instead of bitflags 2011-01-11 16:53:05 -08:00
Ryan Dahl
82e9da9fb7 Allow one extra ms in timer diff
Fixes sporadic test-next-tick-ordering.js failures
2011-01-11 16:51:09 -08:00
Ryan Dahl
dd53ceebe4 lint 2010-12-01 20:59:06 -08:00
Michael W
5f3464cf4e fixed timers, whoops.
Fixes issue https://github.com/ry/node/issues/issue/481
2010-11-30 22:33:29 -08:00
Michael W
645c3b3713 Fixed: clearTimeouts calling multiple times
When clearTimeouts was called on a timer multiple times, it would break the
doubly-linked list along with future timeouts. This patch fixes that.
2010-11-29 18:17:13 -08:00
Ryan Dahl
7a48fd8455 Handle null values in clearTimeout 2010-10-29 00:00:43 -07:00
Ryan Dahl
bc47353bbe Use the timer list for setTimeout 2010-10-26 14:53:18 -07:00
Ryan Dahl
79944006e2 Move setTimeout and friends into timers module 2010-10-26 14:53:17 -07:00
Ryan Dahl
5cc29b80f2 Move idle timers into its own module 2010-10-26 14:53:17 -07:00