Skip to content

Instantly share code, notes, and snippets.

Hi,
Trying to compile this on MacOS 10.7.5, I get the following build error in libuv:
...
ar rcs libuv.a src/unix/async.o src/unix/core.o src/unix/dl.o src/unix/error.o src/unix/fs.o src/unix/getaddrinfo.o src/unix/loop.o src/unix/loop-watcher.o src/unix/pipe.o src/unix/poll.o src/unix/process.o src/unix/signal.o src/unix/stream.o src/unix/tcp.o src/unix/thread.o src/unix/threadpool.o src/unix/timer.o src/unix/tty.o src/unix/udp.o src/fs-poll.o src/uv-common.o src/inet.o
link: rt/x86_64-apple-darwin/librustrt.dylib
Undefined symbols for architecture x86_64:
"_uv__hrtime", referenced from:
_uv_hrtime in libuv.a(core.o)
commit 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
e11cb529a1e20f27d99033181a9e0e131817136b46d2742f0fa1afa1210053e5 rust-0.6.tar.gz
54d16fec24c512676bd8ef7117540c839a4e48e5f0e79a2dd3999633ef625ab3 rust-0.6-install.exe
@brson
brson / gist:5348418
Last active December 16, 2015 00:29
io
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
@brson
brson / gist:5384590
Last active December 16, 2015 05:29

Terms

  • I/O handle

Functional Requirements

I/O

  • Task's performing I/O must not block progress of other tasks
  • I/O handles must be sendable?
fn get_contexts(&mut self) -> (&'self mut Context,
Option<&'self mut Context>,
Option<&'self mut Context>) {
fn get_contexts<'a>(&mut self) -> (&'a mut Context,
Option<&'a mut Context>,
Option<&'a mut Context>) {
let last_task = match self.cleanup_job {
Some(RescheduleTask(~ref task)) |
Some(RecycleTask(~ref task)) |
Some(GiveTask(~ref task, _)) => {
Some(task)
}
Some(DoNothing) => {
@brson
brson / gist:5399629
Last active December 16, 2015 07:38
# Organization
* core/
* io - I/O traits
* file - Non-blocking file I/O
* net - Non-blocking TCP/UDP/Unix sockets
* blocking - Blocking I/O
* file
* dir - file/directory traversal, etc.
* rt - runtime implementation details
struct BufWriter<'self> {
buf: &'self mut [u8],
pos: uint
}
impl<'self> BufWriter<'self> {
fn new(buf: &'self mut [u8]) -> BufWriter {
BufWriter {
buf: buf,
pos: 0
#include <limits>
#if __has_include (<cxxabi.h>)
#include <cxxabi.h>
#endif
#if __has_include (<unwind.h>)
@brson
brson / gist:5498910
Last active December 16, 2015 21:20
# Constraints
* We want to try a [work stealing] scheduling strategy. Under work stealing, tasks are scheduled greedily, as soon as they are available to run, on the thread that is trying to schedule them. Two communicating tasks will naturally converge on the same thread.
* We should be able to support variations on scheduling strategies, possibly including work *sharing*
* I/O is provided per-scheduler (per-thread) by libuv
* I/O handles are tied to the event loop (and therefore thread/scheduler) on which they were created. They have 'scheduler affinity'. Because tasks may migrate threads this means that before every I/O operation a task must arrange to be running on the correct scheduler.
* We must be able to allocate an entire scheduler (thread) exclusively to a single task.
* It should generally be implementable without locks
[work stealing]: https://github.com/mozilla/rust/issues/4877