ajohnsen@google.com
c7a15b7c2b
Add support for cloning server-sockets.
...
BUG=
R=lrn@google.com , sgjesse@google.com
Review URL: https://codereview.chromium.org//250513002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35818 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-06 19:09:44 +00:00
ajohnsen@google.com
8f41c24471
Make server-sockets level triggered.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//234843003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35302 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 06:05:46 +00:00
ajohnsen@google.com
1a8f76beb3
Only return eventhandler tokens in stacks of 8, to avoid runtime calls.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//208653012
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34359 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-25 13:44:01 +00:00
ajohnsen@google.com
4f613457d6
Speed up GetRandomBytes by only entering signal-blocking scope once.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//209333014
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34356 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-25 13:06:37 +00:00
ajohnsen@google.com
0c157cd31e
Move signal_blocker to platform and use it by default in TEMP_FAILURE_RETRY.
...
BUG=http://code.google.com/p/dart/issues/detail?id=16927
R=johnmccutchan@google.com , sgjesse@google.com
Review URL: https://codereview.chromium.org//165723007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33745 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-17 13:51:11 +00:00
ajohnsen@google.com
9a71498127
Make the event-handler handle backpreasure.
...
We now limit the number of active events per fd to 8.
BUG=
R=whesse@google.com
Review URL: https://codereview.chromium.org//198743002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33649 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-13 12:02:47 +00:00
ajohnsen@google.com
e87d3883b9
Fix error-checking when calling timerfd_create.
...
BUG=https://code.google.com/p/dart/issues/detail?id=17051
R=kasperl@google.com
Review URL: https://codereview.chromium.org//177643002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32960 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-24 12:45:16 +00:00
sgjesse@google.com
37913b1e00
Add missing mutex protection for timeout queue with mutex
...
Holding the timer_mutex_ is required to access the timeout_queue_ data
structure. This was missing for epoll events.
R=kustermann@google.com
BUG=
Review URL: https://codereview.chromium.org//174033002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32856 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-20 17:21:27 +00:00
ajohnsen@google.com
e3372e72e9
Remove SocketData and now only pass the dart port to epoll.
...
This avoids keeping extra data alive.
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//171503009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32846 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-20 08:56:54 +00:00
ajohnsen@google.com
cabe710753
Remove 'mask' from SocketData, as it's not required.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//167193004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32794 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-19 16:15:00 +00:00
ajohnsen@google.com
6bbd44db73
Also make eventhandler on Android edge-triggered.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//172133004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32791 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-19 13:29:13 +00:00
ajohnsen@google.com
140fddd06e
Make event-handlers edge-triggered and move socket-state to Dart.
...
This eliminates to pause/resume calls made in the previous one-shot based model.
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//169383003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32780 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-19 09:44:26 +00:00
ajohnsen@google.com
0f52be7f63
Make std* blocking file-descriptors.
...
This will most likely be a performance regression when piping, that
we'll have to look into in the future (copying data through
message-passing).
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//154273003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32715 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-17 10:06:35 +00:00
ajohnsen@google.com
69d20ad7d3
Don't make timerfd non-blocking and add errno to error-mesage.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//107143005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31162 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-16 14:48:33 +00:00
ajohnsen@google.com
9a8edb6924
Use timerfd to handle timeouts on Linux.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//104803005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30884 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-05 09:22:07 +00:00
ajohnsen@google.com
2b83a250a5
Fix re-adding to epoll, when event is unhandled.
...
BUG=
Review URL: https://codereview.chromium.org//83483003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30576 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-22 13:56:40 +00:00
ajohnsen@google.com
c98d0bde22
Read up to 8 InterruptMessages at a time, in unix eventhandlers.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//83173003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30574 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-22 12:50:29 +00:00
ajohnsen@google.com
d2e3c3d573
Limit the number of syscalls made by the Eventhandler.
...
We now let epoll use EPOLLONESHOT instead of manual unsubscribing, and
only to handle timeouts when no IO events was received.
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//82873002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30566 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-22 08:24:40 +00:00
ajohnsen@google.com
ff5f4fbdc9
Only read from interrupt_fd when data is available.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//77983002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30453 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-20 10:26:59 +00:00
ajohnsen@google.com
c6ef82b5c9
Polish the EventHandler cleanup in r26517.
...
BUG=
R=iposva@google.com , sgjesse@google.com
Review URL: https://codereview.chromium.org//22918023
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27386 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-11 15:31:44 +00:00
ajohnsen@google.com
3dfe7c97e2
Always initialize the EventHandler in the standalone.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//22901017
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26517 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-22 12:03:59 +00:00
jacobr@google.com
605b33c1bc
fix cpp11 compile errors
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//23072026
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26387 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 20:24:11 +00:00
cbracken@google.com
a6ace331f3
Replaced strerror() calls with threadsafe strerror_r().
...
Mac/Android use the XSI-compliant definition of strerror_r() which stores the message in the passed-in buffer.
Linux uses the GNU-specific definition of strerror_r() which takes a buffer and returns the message in a char* (which may or may not be the passed-in buffer).
BUG=
R=iposva@google.com
Review URL: https://codereview.chromium.org//22634003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25943 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-08 20:24:05 +00:00
ajohnsen@google.com
2bd55c23c7
Keep track of when a socket has been destroyed
...
This adds the event CLOSED to RawSocket and RawServerSocket. This
event indicate that the underlying socket is now destroyed.
This is used to make Socket.close and ServerSocket.close return a
future which is completed when the unserlying socket is
destroyed. This can be used to start listening on the same port after
closing a server socket.
R=ajohnsen@google.com , kustermann@google.com
BUG=https://code.google.com/p/dart/issues/detail?id=4155
Review URL: https://codereview.chromium.org//14864009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25213 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 13:26:48 +00:00
ajohnsen@google.com
1e2289e275
One event ahndler for all isolates
...
BUG=
R=whesse@google.com
Review URL: https://codereview.chromium.org//17851004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25082 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-17 07:26:05 +00:00
ajohnsen@google.com
d506a6e490
Stop printing when stdout is closed.
...
This makes sure we don't print(...) data to a file opened after stdout
was closed.
BUG=https://code.google.com/p/dart/issues/detail?id=9615
R=kustermann@google.com , whesse@google.com
Review URL: https://codereview.chromium.org//18031003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24525 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-27 16:44:39 +00:00
sgjesse@google.com
89a21f2479
Change the timeout handling in the standalone VM to use 64-bit integers
...
R=floitsch@google.com
BUG=
Review URL: https://codereview.chromium.org//17878002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24466 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-26 13:33:10 +00:00
smok@google.com
ebbc2020a2
Put everything in runtime/bin into '::dart::bin' namespace.
...
Review URL: https://codereview.chromium.org//14341015
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22032 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-25 14:22:30 +00:00
ager@google.com
26c4b3a58d
Fix file descriptor leak in event handler implementation. When shutting down an isolate, we did not destruct the eventhandler so we leaked the file descriptors for it.
...
Also fix leak of monitor wait data objects on Windows.
R=sgjesse@google.com
BUG=dartbug.com/9021
Review URL: https://codereview.chromium.org//12646007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19921 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-13 11:11:38 +00:00
ajohnsen@google.com
a30171117c
Handle /dev/null on linux, as an closed device.
...
This will make all devices unsupported by epoll act as an empty source.
BUG=
Review URL: https://codereview.chromium.org//12476021
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19796 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-11 15:16:08 +00:00
ajohnsen@google.com
03ac5fcaf2
Handle single EPOLLHUP epoll events on Linux.
...
BUG=
Review URL: https://codereview.chromium.org//12328052
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18878 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-22 11:42:32 +00:00
ajohnsen@google.com
5068d80262
Handle legacy epoll event on Linux.
...
This should fix flaky tests on older versions of Linux (including those
running buildbot).
Also re-enable test on linux.
BUG=
Review URL: https://codereview.chromium.org//12319067
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18873 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-22 09:51:08 +00:00
sgjesse@google.com
488b016a2f
Merge IO v2 branch to bleeding edge
...
R=ager@google.com , ajohnsen@google.com , whesse@google.com
BUG=
Review URL: https://codereview.chromium.org//12316036
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18820 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 11:58:11 +00:00
iposva@google.com
9046a44a37
Prepare for removal of source_filter.gypi:
...
- Guard OS-dependent source files with #if TARGET_OS_* in a similar
fashion to the architecture dependent sources.
Review URL: https://codereview.chromium.org//12282051
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18786 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-20 21:17:38 +00:00
tball@google.com
fe80553fdd
Moved GetCurrentTime functions from bin/eventhandler to bin/utils.
...
Review URL: https://codereview.chromium.org//12280004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18597 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-15 20:51:49 +00:00
kustermann@google.com
c20c523de8
Set close-on-exec flag on pipe() and epoll() file descriptors
...
Review URL: https://codereview.chromium.org//11644017
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16308 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-19 09:36:47 +00:00
gram@google.com
3601944836
Revised CL for customisable logging (replacing printfs).
...
Review URL: https://codereview.chromium.org//11312242
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15096 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 17:38:15 +00:00
ager@google.com
5c9f9ef74f
Avoid needless int64_t to intptr_t conversion in eventhandler.
...
R=sgjesse@google.com
BUG=
Review URL: https://codereview.chromium.org//10962026
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12693 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 11:40:40 +00:00
cshapiro@google.com
da14bf70a7
Add attributions so printf like functions can have their arguments checked.
...
This change also corrects some misuses of format strings and format
arguments that discovered by the compiler checks.
Review URL: https://chromiumcodereview.appspot.com//10869063
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11912 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-06 00:58:25 +00:00
asiva@google.com
9d123e5366
Move hashmap.h and hashmap.cc from the 'bin' directory to 'platform' directory so that it can be used from VM code too.
...
Review URL: https://chromiumcodereview.appspot.com//10853009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10261 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 22:11:30 +00:00
ager@google.com
f791a12b38
Terminate event handler thread on isolate shutdown.
...
R=sgjesse@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//10693039
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9251 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-29 14:40:17 +00:00
ager@google.com
989daa8d1d
Fix invalid pointer arithmetic in Linux and MacOS event handler
...
implementations.
R=sgjesse@google.com
BUG=dartbug.com/2759
TEST=
Review URL: https://chromiumcodereview.appspot.com//10243003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7066 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-27 11:07:01 +00:00
ager@google.com
37147fc116
Remove unused thread pool from standalone VM binary.
...
We are using the thread pool in the VM via native ports.
R=sgjesse@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9875006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5954 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-28 21:57:58 +00:00
sgjesse@google.com
0b3f4a1190
Extend dart:io error handling to all socket functions
...
There are currently no tests of the error handling, as it is hard to
create consistent tests. I have done some manual tests locally:
* Lowering the number of file descriptors available (ulimit -n) and hitting that limit
* Running two dart programs communicating and terminating one (using Ctrl-C)
* Running two dart programs communicating on two machines and pulling out the network cable.
If there is an error we always call the onError callback and never the onClosed callback.
On Windows there is the issue that both closing the connection correctly and terminating one end gives the same error (ERROR_NETNAME_DELETED) so both are reported as connection close. Pulling out the network cable gives a different (real) error on Windows though.
On Mac OS it turned out the for kqueue EV_EOF is also used to indicate errors with the error code set in the fflags field. EV_ERROR is only reported if there is an internal error in kevent processing (see http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/kqueue.2.html ).
R=ager@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9720045
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5709 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-21 09:39:47 +00:00
sgjesse@google.com
b4d571dcdd
Handle stdio redirection in standalone VM
...
The recent change to epoll on Linux and kqueue on Mac OS for getting
notifications from file descriptors caused the redirection of stdin,
stdout and stderr for the stand alone VM to stop working.
On Linux epoll failed when file descriptor 0, 1 or 2 redirected from
or to a file war registered. On Mac OS there was just no events
generated from kqueue.
The streams created for stdio, stdout and stderr is now of the correct
type and for file redirections no longer a socket object holding a
file descriptor for a regular file.
Added testing of stdio redirection using both pipes and files. These
tests are currently skipped on Windows.
Fixed handlin of short socket read when reading the process exit code.
Always close the socket port when not waiting for any events.
R=iposva@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9360040
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4226 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-14 15:20:27 +00:00
ager@google.com
e4f7a8d620
Use epoll for the event handler on Linux.
...
epoll is faster than poll and we avoid iterating all potential
file descriptors all the time.
R=sgjesse@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9332003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3980 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-07 08:19:33 +00:00
sgjesse@google.com
4e9686dc4b
Implemented encoding af a Dart_CMessage structure into a Dart message. Currently supported types are:
...
Boolean
Smi
Double
String
Array
The encoding uses the upper bits of the Dart_CObject type field for "marking" already written objects with their object id for generating backward references. After serialization these mark are removed.
Added the API Dart_PostCMessage for encoding and posting a Dart_CMessage structure.
Removed the API Dart_PostIntArray and used Dart_PostCMessage instead.
R=asive@google.com ,turnidge@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9104041
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3947 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-06 15:42:15 +00:00
sgjesse@google.com
42b70dcddb
Change the thread interface in runtime/platform and use it starting all threads
...
The platform thread interface (dart::thread) is now refactored to an
all static interface as suggested by iposva@ and asiva@. Use this
interface for running all threads in the VM.
R=ager@google.com , iposva@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9141005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3830 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-02 08:59:26 +00:00
ager@google.com
0f9fdc51d3
Add extra debug information when failing to deliver an interrupt message.
...
R=sgjesse@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9212041
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3539 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-24 09:52:53 +00:00
sgjesse@google.com
c1d041500f
Use hash map for event handler file descriptor map
...
Instead of using an array indexed using the file descriptor for
looking up data associated with a socket (SocketData objects) this is
now stored in a hash map using the file descriptor as key.
Added hash map implementation like the one used in the V8 project.
R=ager@google.com , whesse@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9186035
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3483 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-23 09:10:51 +00:00