This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So here's the things to consider: | |
* Do not preallocate a read buffer per socket. | |
Either use polling or use a shared buffer pool. | |
* Avoid statefulnews, e.g: | |
- In windows, you can't use multiple completion ports with a handle. | |
- On unix, a socket is either in blocking or non-blocking mode | |
This creates problems when you want to share a handle with other processes | |
or between threads. For example, you might want to switch stdout to | |
non-blocking, but if stdout was inherited and shared with the parent | |
process, the parent process might not expect this and crash or malfunction. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashMap; | |
use std::sync::Mutex; | |
#[macro_use] | |
extern crate lazy_static; | |
struct CoreOp {} // Placeholder. | |
struct FlatBuffer {} // Placeholder. | |
struct PinnedBuf {} // Placeholder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::cell::Cell; | |
use std::marker::PhantomData; | |
// Dummy placeholders representing raw v8 objects. | |
struct V8Isolate {} | |
struct V8HandleScope {} | |
// Scope that controls access to the Isolate and active HandleScope. | |
struct Scope<'a, S, P> { | |
parent: Option<&'a mut P>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { test, runIfMain } from "https://deno.land/std/testing/mod.ts"; | |
import { assertEquals } from "https://deno.land/std/testing/asserts.ts"; | |
export class Latch<T> { | |
// Array of `[resolve_function, value]` tuples. | |
send_queue: Array<[() => void, T]> = [] | |
// Array of `resolve_function` values. | |
recv_queue: Array<(value: T) => void> = [] | |
send(value: T): Promise<void> { |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A typescript helper type that lets you define functions with rest spread | |
// parameters at the beginning, like: | |
// | |
// `function cool(...many: string[], must_have: SomeObject, extra?: boolean)`; | |
// | |
// See test.ts for an example on how to use it. | |
export type Args = Array<unknown>; | |
// prettier-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\Users\BertBelder\d\deno\out\debug>rustc ../../src/main.rs --crate-name=deno_bin --crate-type=staticlib --emit=link,dep-info --out-dir=rust_crates -Cextra-filename= -Cmetadata= -L dependency=rust_crates --color=always -g --extern hyper=rust_crates/libhyper.rlib --extern hyper_rustls=rust_crates/libhyper_rustls.rlib --extern futures=rust_crates/libfutures.rlib --extern lazy_static=rust_crates/liblazy_static.rlib --extern libc=rust_crates/liblibc.rlib --extern log=rust_crates/liblog.rlib --extern ring=rust_crates/libring.rlib --extern tempfile=rust_crates/libtempfile.rlib --extern rand=rust_crates/librand.rlib --extern tokio=rust_crates/libtokio.rlib --extern tokio_io=rust_crates/libtokio_io.rlib --extern tokio_fs=rust_crates/libtokio_fs.rlib --extern tokio_executor=rust_crates/libtokio_executor.rlib --extern tokio_threadpool=rust_crates/libtokio_threadpool.rlib --extern url=rust_crates/liburl.rlib --extern remove_dir_all=rust_crates/libremove_dir_all.rlib --extern dirs=rust_crates/libdirs.rlib --extern flatb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"C:\\\\Users\\\\BertBelder\\\\d\\\\deno4\\\\out\\\\debug\\\\../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe" | |
"-E" | |
"../../third_party/v8/src/compiler/graph-reducer.cc" | |
"-nologo" | |
"-nologo" | |
"-imsvc..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\Enterprise\\\\VC\\\\Tools\\\\MSVC\\\\14.14.26428\\\\ATLMFC\\\\include" | |
"-imsvc..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\Enterprise\\\\VC\\\\Tools\\\\MSVC\\\\14.14.26428\\\\include" | |
"-imsvc..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\Program Files (x86)\\\\Windows Kits\\\\NETFXSDK\\\\4.6.1\\\\include\\\\um" | |
"-imsvc..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\Program Files (x86)\\\\Windows Kits\\\\10\\\\include\\\\10.0.17134.0\\\\ucrt" | |
"-imsvc..\\\\..\\\\..\\\\..\\\\..\\\\..\\\\Program Files (x86)\\\\Windows Kits\\\\10\\\\include\\\\10.0.17134.0\\\\shared" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BuildCommandLine([string[]] $ArgumentList) { | |
$special_chars = '[\x00-\x20"^%~!@&?*<>|()\\=]' | |
$quoted_args = $ArgumentList | foreach { | |
if ($_ -match $special_chars) { | |
# Double all double-quote characters. | |
$_ = $_ -replace '"', '""' | |
# Wrap in double-quote characters. | |
$_ = """$_""" | |
# Double all backslashes that are followed by \. | |
$_ = $_ -replace '[\\]+(?=")', '$0$0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { | |
openSync, | |
closeSync, | |
read, | |
readSync, | |
unlinkSync, | |
writeFileSync | |
} = require("fs"); | |
const { tmpdir } = require("os"); | |
const { resolve } = require("path"); |