about summary refs log tree commit diff
path: root/src/libgreen
AgeCommit message (Collapse)AuthorLines
2014-01-06Register new snapshotsAlex Crichton-3/+0
2014-01-04Don't allow newtype structs to be dereferenced. #6246Brian Anderson-2/+2
2014-01-04auto merge of #11306 : alexcrichton/rust/native-bounds, r=pcwaltonbors-0/+8
This allows inspection of the current task's bounds regardless of what the underlying task is. Closes #11293
2014-01-04Add a stack_bounds function to the Runtime traitAlex Crichton-0/+8
This allows inspection of the current task's bounds regardless of what the underlying task is. Closes #11293
2014-01-02Bump version to 0.9Brian Anderson-1/+1
2014-01-01Move task count bookeeping out of libstdAlex Crichton-26/+131
For libgreen, bookeeping should not be global but rather on a per-pool basis. Inside libnative, it's known that there must be a global counter with a mutex/cvar. The benefit of taking this strategy is to remove this functionality from libstd to allow fine-grained control of it through libnative/libgreen. Notably, helper threads in libnative can manually decrement the global count so they don't count towards the global count of threads. Also, the shutdown process of *all* sched pools is now dependent on the number of tasks in the pool being 0 rather than this only being a hardcoded solution for the initial sched pool in libgreen. This involved adding a Local::try_take() method on the Local trait in order for the channel wakeup to work inside of libgreen. The channel send was happening from a SchedTask when there is no Task available in TLS, and now this is possible to work (remote wakeups are always possible, just a little slower).
2013-12-29Fix a deadlock in a libgreen testAlex Crichton-1/+1
Turns out when you grab an OS mutex, you need to be careful about when and where things are scheduled!
2013-12-26Remove green scheduler bootstrap tasksAlex Crichton-34/+16
Closes #11054
2013-12-26Register new snapshotsAlex Crichton-1/+0
2013-12-25Test fixes and rebase conflictsAlex Crichton-21/+20
* vec::raw::to_ptr is gone * Pausible => Pausable * Removing @ * Calling the main task "<main>" * Removing unused imports * Removing unused mut * Bringing some libextra tests up to date * Allowing compiletest to work at stage0 * Fixing the bootstrap-from-c rmake tests * assert => rtassert in a few cases * printing to stderr instead of stdout in fail!()
2013-12-24green: Move a scheduler test inside libgreenAlex Crichton-1/+72
This test also had a race condition in using the cvar/lock, so I fixed that up as well. The race originated from one half trying to destroy the lock when another half was using it.
2013-12-24std: Remove must deferred sending functionsAlex Crichton-4/+9
These functions are all unnecessary now, and they only have meaning in the M:N context. Removing these functions uncovered a bug in the librustuv timer bindings, but it was fairly easy to cover (and the test is already committed). These cannot be completely removed just yet due to their usage in the WaitQueue of extra::sync, and until the mutex in libextra is rewritten it will not be possible to remove the deferred sends for channels.
2013-12-24rustuv: Fix a memory leak (documented inside)Alex Crichton-7/+25
This happened because the environment of a procedure was never deallocated.
2013-12-24native: Protect against spurious wakeups on cvarsAlex Crichton-13/+24
This is a very real problem with cvars on normal systems, and all of channels will not work if spurious wakeups are accepted. This problem is just solved with a synchronized flag (accessed in the cvar's lock) to see whether a signal() actually happened or whether it's spurious.
2013-12-24green: Properly wait for main before shutdownAlex Crichton-15/+111
There was a race in the code previously where schedulers would *immediately* shut down after spawning the main task (because the global task count would still be 0). This fixes the logic by blocking the sched pool task in receving on a port instead of spawning a task into the pool to receive on a port. The modifications necessary were to have a "simple task" running by the time the code is executing, but this is a simple enough thing to implement and I forsee this being necessary to have implemented in the future anyway.
2013-12-24Test fixes and rebase problemsAlex Crichton-7/+15
Note that this removes a number of run-pass tests which are exercising behavior of the old runtime. This functionality no longer exists and is thoroughly tested inside of libgreen and libnative. There isn't really the notion of "starting the runtime" any more. The major notion now is "bootstrapping the initial task".
2013-12-24green: Fixing all tests from previous refactoringsAlex Crichton-279/+347
2013-12-24green: Allow specifying an IoFactory for poolsAlex Crichton-6/+16
This allows creation of different sched pools with different io factories. Namely, this will be used to test the basic I/O loop in the green crate. This can also be used to override the global default.
2013-12-24rustuv: Write homing tests with SchedPoolAlex Crichton-38/+39
Use the previous commit's new scheduler pool abstraction in libgreen to write some homing tests which force an I/O handle to be homed from one event loop to another.
2013-12-24Finalize the green::Pool typeAlex Crichton-188/+141
The scheduler pool now has a much more simplified interface. There is now a clear distinction between creating the pool and then interacting the pool. When a pool is created, all schedulers are not active, and only later if a spawn is done does activity occur. There are four operations that you can do on a pool: 1. Create a new pool. The only argument to this function is the configuration for the scheduler pool. Currently the only configuration parameter is the number of threads to initially spawn. 2. Spawn a task into this pool. This takes a procedure and task configuration options and spawns a new task into the pool of schedulers. 3. Spawn a new scheduler into the pool. This will return a handle on which to communicate with the scheduler in order to do something like a pinned task. 4. Shut down the scheduler pool. This will consume the scheduler pool, request all of the schedulers to shut down, and then wait on all the scheduler threads. Currently this will block the invoking OS thread, but I plan on making 'Thread::join' not a thread-blocking call. These operations can be used to encode all current usage of M:N schedulers, as well as providing a simple interface through which a pool can be modified. There is currently no way to remove a scheduler from a pool of scheduler, as there's no way to guarantee that a scheduler has exited. This may be added in the future, however (as necessary).
2013-12-24std: Get stdtest all passing againAlex Crichton-0/+2
This commit brings the library up-to-date in order to get all tests passing again
2013-12-24green: Rip the bandaid off, introduce libgreenAlex Crichton-0/+3082
This extracts everything related to green scheduling from libstd and introduces a new libgreen crate. This mostly involves deleting most of std::rt and moving it to libgreen. Along with the movement of code, this commit rearchitects many functions in the scheduler in order to adapt to the fact that Local::take now *only* works on a Task, not a scheduler. This mostly just involved threading the current green task through in a few locations, but there were one or two spots where things got hairy. There are a few repercussions of this commit: * tube/rc have been removed (the runtime implementation of rc) * There is no longer a "single threaded" spawning mode for tasks. This is now encompassed by 1:1 scheduling + communication. Convenience methods have been introduced that are specific to libgreen to assist in the spawning of pools of schedulers.