18 Commits

Author SHA1 Message Date
Christopher Davis
2447fe8886 Add event_config_set_num_cpus_hint for tuning thread pools, etc. 2010-09-08 01:22:22 -07:00
Christopher Davis
76f7e7ae74 Some IOCP bufferevent tweaks.
- Increment reference count of bufferevents before initiating overlapped
  operations to prevent the destructor from being called while operations
  are pending. The only portable way of canceling overlapped ops is to
  close the socket.

- Translate error codes to WSA* codes.

- Better handling of errors.

- Add an interface to add and del "virtual" events. Because IOCP
  bufferevents don't register any events with the base, the event loop
  has no way of knowing they exist. This causes the loop to terminate
  prematurely. event_base_{add,del}_virtual increment/decrement base's
  event count so the loop runs while there are any enabled IOCP
  bufferevents.
2010-09-08 01:22:22 -07:00
Christopher Davis
d844242f9b Stop IOCP when freeing the event_base. 2010-09-08 01:22:21 -07:00
Nick Mathewson
17efc1cdfa Update all our copyright notices to say "2010" 2010-03-04 01:38:48 -05:00
Nick Mathewson
32c6f1bacd Construct Windows locks using InitializeCriticalSectionAndSpinCount
Previously we were using InitializeCriticalSection, which creates a
lock that blocks immediately on contention and waits to be
rescheduled.  This is inefficient; it's better to wait for a little
while before telling the US to reschedule us, in case the lock becomes
available again really soon (since most locks mostly do).

Good pthreads implementations do this automatically.  On Windows,
though, we need to call this magic function, and we need to pick the
spin count ourselves.
2010-02-18 00:27:13 -05:00
Nick Mathewson
cef61a2f1b Use ev_[u]intptr_t types in place of [u]intptr_t 2010-01-26 12:08:17 -05:00
Nick Mathewson
a84c87d76a Refactor IOCP callback interface
Chris Davis points out that GetQueuedCompletionStatus
sometimes returns false not to report "No events for
you!" but instead to report "An overlapped operation
failed."  Add a way to tell an event_overlapped that
its operation failed.

svn:r1490
2009-11-02 19:51:26 +00:00
Nick Mathewson
fa313f28c5 Extract XP-only functions when initializing the IOCP port
svn:r1479
2009-10-29 18:30:43 +00:00
Nick Mathewson
5b5b880be7 Various MSVC cleanups from Brodie Thiesfield.
svn:r1385
2009-07-28 19:41:39 +00:00
Nick Mathewson
7a844735d5 Fix some small win32 build issues on trunk.
svn:r1306
2009-05-22 17:20:05 +00:00
Nick Mathewson
fe47003d06 Make unit tests for bufferevent_async compile and _almost_ work.
Either I need to make the callbacks get deferred in a base with no events (doable), or I need to make it okay to call launch_read from inside the callback for read (tricky).

svn:r1277
2009-05-05 16:52:37 +00:00
Nick Mathewson
b69d03b5a8 Add a constructor for bufferevent_async.
svn:r1274
2009-05-05 14:18:14 +00:00
Nick Mathewson
f1090833b2 First tests for IOCP loop, and related fixes.
The fixes are: a shutdown mode that works, and a way to activate an
arbitrary event_overlapped.

svn:r1254
2009-04-30 19:04:44 +00:00
Nick Mathewson
eda27f9557 Update copyright notices, add some missing license statements
svn:r1208
2009-04-19 20:54:12 +00:00
Nick Mathewson
0b98781353 More hacking on event_iocp.c: make it compile, and give it more of an interface. This code is now testable.
svn:r1176
2009-04-16 00:32:52 +00:00
Nick Mathewson
09c23b6a56 It seems support for GetCompletionEventEx is not in my mingw. Use the simpler interface instead, for now.
svn:r1175
2009-04-16 00:27:32 +00:00
Nick Mathewson
93d4f884aa Make buffer iocp stuff compile happily
svn:r1174
2009-04-14 20:11:10 +00:00
Nick Mathewson
ca737ff3b5 Add draft (nonworking) versions of iocp code to hack on more.
svn:r1172
2009-04-13 18:29:31 +00:00