04bc611751
Create handle objects for stdin/stdout/stderr. For Mac OS and Linus the file descriptor numbers are used but on Windows the handles are wrapped in an object. The system handles for stdin/stdout/stderr on Windows does not support overlapped IO. To mittigate this the write calls are performed synchronously and the read calls are preformed in a thread which posts the result through the completion potr where it is handled as if it originated from overlapped IO through the completion port. For now each call to read starts a new thread. R=ager@google.com BUG= TEST= Review URL: http://codereview.chromium.org//8574002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1533 260f80e4-7a28-3924-810f-c04153c831b5
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef BIN_SOCKET_H_
|
|
#define BIN_SOCKET_H_
|
|
|
|
#include "bin/builtin.h"
|
|
#include "bin/globals.h"
|
|
|
|
|
|
class Socket {
|
|
public:
|
|
static bool Initialize();
|
|
static intptr_t Available(intptr_t fd);
|
|
static intptr_t Read(intptr_t fd, void* buffer, intptr_t num_bytes);
|
|
static intptr_t Write(intptr_t fd, const void* buffer, intptr_t num_bytes);
|
|
static intptr_t CreateConnect(const char* host, const intptr_t port);
|
|
static intptr_t GetPort(intptr_t fd);
|
|
static intptr_t GetStdioHandle(int num);
|
|
|
|
DISALLOW_ALLOCATION();
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Socket);
|
|
};
|
|
|
|
|
|
class ServerSocket {
|
|
public:
|
|
static intptr_t Accept(intptr_t fd);
|
|
static intptr_t CreateBindListen(const char* bindAddress,
|
|
intptr_t port,
|
|
intptr_t backlog);
|
|
|
|
DISALLOW_ALLOCATION();
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket);
|
|
};
|
|
|
|
#endif // BIN_SOCKET_H_
|