<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/libstd/rt/local.rs, branch beta</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=beta</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=beta'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2014-06-07T05:19:41+00:00</updated>
<entry>
<title>std: Extract librustrt out of libstd</title>
<updated>2014-06-07T05:19:41+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-06-04T02:11:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5ec36c358f74fe83332231e774ea20a21d165120'/>
<id>urn:sha1:5ec36c358f74fe83332231e774ea20a21d165120</id>
<content type='text'>
As part of the libstd facade efforts, this commit extracts the runtime interface
out of the standard library into a standalone crate, librustrt. This crate will
provide the following services:

* Definition of the rtio interface
* Definition of the Runtime interface
* Implementation of the Task structure
* Implementation of task-local-data
* Implementation of task failure via unwinding via libunwind
* Implementation of runtime initialization and shutdown
* Implementation of thread-local-storage for the local rust Task

Notably, this crate avoids the following services:

* Thread creation and destruction. The crate does not require the knowledge of
  an OS threading system, and as a result it seemed best to leave out the
  `rt::thread` module from librustrt. The librustrt module does depend on
  mutexes, however.
* Implementation of backtraces. There is no inherent requirement for the runtime
  to be able to generate backtraces. As will be discussed later, this
  functionality continues to live in libstd rather than librustrt.

As usual, a number of architectural changes were required to make this crate
possible. Users of "stable" functionality will not be impacted by this change,
but users of the `std::rt` module will likely note the changes. A list of
architectural changes made is:

* The stdout/stderr handles no longer live directly inside of the `Task`
  structure. This is a consequence of librustrt not knowing about `std::io`.
  These two handles are now stored inside of task-local-data.

  The handles were originally stored inside of the `Task` for perf reasons, and
  TLD is not currently as fast as it could be. For comparison, 100k prints goes
  from 59ms to 68ms (a 15% slowdown). This appeared to me to be an acceptable
  perf loss for the successful extraction of a librustrt crate.

* The `rtio` module was forced to duplicate more functionality of `std::io`. As
  the module no longer depends on `std::io`, `rtio` now defines structures such
  as socket addresses, addrinfo fiddly bits, etc. The primary change made was
  that `rtio` now defines its own `IoError` type. This type is distinct from
  `std::io::IoError` in that it does not have an enum for what error occurred,
  but rather a platform-specific error code.

  The native and green libraries will be updated in later commits for this
  change, and the bulk of this effort was put behind updating the two libraries
  for this change (with `rtio`).

* Printing a message on task failure (along with the backtrace) continues to
  live in libstd, not in librustrt. This is a consequence of the above decision
  to move the stdout/stderr handles to TLD rather than inside the `Task` itself.
  The unwinding API now supports registration of global callback functions which
  will be invoked when a task fails, allowing for libstd to register a function
  to print a message and a backtrace.

  The API for registering a callback is experimental and unsafe, as the
  ramifications of running code on unwinding is pretty hairy.

* The `std::unstable::mutex` module has moved to `std::rt::mutex`.

* The `std::unstable::sync` module has been moved to `std::rt::exclusive` and
  the type has been rewritten to not internally have an Arc and to have an RAII
  guard structure when locking. Old code should stop using `Exclusive` in favor
  of the primitives in `libsync`, but if necessary, old code should port to
  `Arc&lt;Exclusive&lt;T&gt;&gt;`.

* The local heap has been stripped down to have fewer debugging options. None of
  these were tested, and none of these have been used in a very long time.

[breaking-change]
</content>
</entry>
<entry>
<title>std: Remove run_in_bare_thread</title>
<updated>2014-05-15T20:50:50+00:00</updated>
<author>
<name>Brian Anderson</name>
<email>banderson@mozilla.com</email>
</author>
<published>2014-05-14T08:13:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=514fc308b0bcf903260f1e40fd0b18ba91539d35'/>
<id>urn:sha1:514fc308b0bcf903260f1e40fd0b18ba91539d35</id>
<content type='text'>
</content>
</entry>
<entry>
<title>librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, except</title>
<updated>2014-05-07T06:12:54+00:00</updated>
<author>
<name>Patrick Walton</name>
<email>pcwalton@mimiga.net</email>
</author>
<published>2014-05-06T01:56:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=090040bf4037a094e50b03d79e4baf5cd89c912b'/>
<id>urn:sha1:090040bf4037a094e50b03d79e4baf5cd89c912b</id>
<content type='text'>
for `~str`/`~[]`.

Note that `~self` still remains, since I forgot to add support for
`Box&lt;self&gt;` before the snapshot.

How to update your code:

* Instead of `~EXPR`, you should write `box EXPR`.

* Instead of `~TYPE`, you should write `Box&lt;Type&gt;`.

* Instead of `~PATTERN`, you should write `box PATTERN`.

[breaking-change]
</content>
</entry>
<entry>
<title>Replace most ~exprs with 'box'. #11779</title>
<updated>2014-05-03T06:00:58+00:00</updated>
<author>
<name>Brian Anderson</name>
<email>banderson@mozilla.com</email>
</author>
<published>2014-04-25T08:08:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a5be12ce7e88c1d28de1c98215991127d1e765f0'/>
<id>urn:sha1:a5be12ce7e88c1d28de1c98215991127d1e765f0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Publicise types/add #[allow(visible_private_types)] to a variety of places.</title>
<updated>2014-02-28T13:12:34+00:00</updated>
<author>
<name>Huon Wilson</name>
<email>dbau.pp+github@gmail.com</email>
</author>
<published>2014-02-27T07:48:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=218eae06ab7c7858057cc6bbd28fb4e0db9f5264'/>
<id>urn:sha1:218eae06ab7c7858057cc6bbd28fb4e0db9f5264</id>
<content type='text'>
There's a lot of these types in the compiler libraries, and a few of the
older or private stdlib ones. Some types are obviously meant to be
public, others not so much.
</content>
</entry>
<entry>
<title>Removing do keyword from libstd and librustc</title>
<updated>2014-01-29T14:15:41+00:00</updated>
<author>
<name>Scott Lawrence</name>
<email>bytbox@gmail.com</email>
</author>
<published>2014-01-27T03:42:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=25e7e7f8076d879f824f013faa6f7470e69c818b'/>
<id>urn:sha1:25e7e7f8076d879f824f013faa6f7470e69c818b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix some warnings</title>
<updated>2014-01-06T02:52:52+00:00</updated>
<author>
<name>Corey Richardson</name>
<email>corey@octayn.net</email>
</author>
<published>2014-01-05T18:05:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=2097570f4ca354d2f0d18c52659c472cda4fab08'/>
<id>urn:sha1:2097570f4ca354d2f0d18c52659c472cda4fab08</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Move task count bookeeping out of libstd</title>
<updated>2014-01-01T21:08:09+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2013-12-30T08:55:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=3f11f8738201dcf230a1647e30c312c980513b37'/>
<id>urn:sha1:3f11f8738201dcf230a1647e30c312c980513b37</id>
<content type='text'>
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).
</content>
</entry>
<entry>
<title>std: Get stdtest all passing again</title>
<updated>2013-12-25T03:59:52+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2013-12-13T05:38:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=018d60509c04cdebdf8b0d9e2b58f2604538e516'/>
<id>urn:sha1:018d60509c04cdebdf8b0d9e2b58f2604538e516</id>
<content type='text'>
This commit brings the library up-to-date in order to get all tests passing
again
</content>
</entry>
<entry>
<title>green: Rip the bandaid off, introduce libgreen</title>
<updated>2013-12-25T03:59:52+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2013-12-13T02:01:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=51abdee5f1ad932671350fdd8a7911fe144d08b8'/>
<id>urn:sha1:51abdee5f1ad932671350fdd8a7911fe144d08b8</id>
<content type='text'>
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.
</content>
</entry>
</feed>
