Re: [rust-dev] How to write Rust code that blocks natively

2012-02-08 Thread Sebastian Sylvan
On Wed, Feb 8, 2012 at 5:21 PM, Brian Anderson wrote: > Hey. > > One of the several painful things about creating bindings for native > libraries is that calling blocking functions prevents other tasks from making > progress. This makes using things like sockets or libuv problematic. No more >

Re: [rust-dev] How to write Rust code that blocks natively

2012-02-08 Thread Graydon Hoare
On 2/8/2012 5:21 PM, Brian Anderson wrote: We currently have a single function that can be used to take advantage of this: core::task::spawn_sched. It spawns a new task into a new scheduler and takes an argument for the number of OS threads the scheduler should use. spawn_sched(1) {||

Re: [rust-dev] How to write Rust code that blocks natively

2012-02-08 Thread Niko Matsakis
This is very cool. On 2/8/12 5:21 PM, Brian Anderson wrote: Hey. One of the several painful things about creating bindings for native libraries is that calling blocking functions prevents other tasks from making progress. This makes using things like sockets or libuv problematic. No more - a

[rust-dev] How to write Rust code that blocks natively

2012-02-08 Thread Brian Anderson
Hey. One of the several painful things about creating bindings for native libraries is that calling blocking functions prevents other tasks from making progress. This makes using things like sockets or libuv problematic. No more - a solution is here! The runtime now allows for schedulers to be