rust/src/libstd/unstable
Alex Crichton f3370295b7 Implement a Once primitive for initialization
Of the 8 static mutexes that are currently in-use by the compiler and its
libraries, 4 of them are currently used for one-time initialization. The
unforunate side effect of using a static mutex is that the mutex is leaked.

This primitive should provide the basis for efficiently keeping track of
one-time initialization as well as ensuring that it does not leak the internal
mutex that is used.

I have chosen to put this in libstd because libstd is currently making use of a
static initialization mutex (rt::local_ptr), but I can also see a more refined
version of this type being suitable to initialize FFI bindings (such as
initializing LLVM and initializing winsock networking on windows). I also intend
on adding "helper threads" to libnative, and those will greatly benefit from a
simple "once" primitive rather than always reinventing the wheel by using
mutexes and bools.

I would much rather see this primitive built on a mutex that blocks green
threads appropriately, but that does not exist at this time, so it does not
belong outside of `std::unstable`.
2013-12-28 19:44:02 -08:00
..
dynamic_lib.rs std: Introduce std::sync 2013-12-24 14:42:00 -08:00
finally.rs Inline Finallyalizer::drop, allowing LLVM to optimize finally. 2013-12-12 07:07:45 +02:00
intrinsics.rs
lang.rs green: Rip the bandaid off, introduce libgreen 2013-12-24 19:59:52 -08:00
mod.rs green: Rip the bandaid off, introduce libgreen 2013-12-24 19:59:52 -08:00
mutex.rs Implement a Once primitive for initialization 2013-12-28 19:44:02 -08:00
raw.rs Make 'self lifetime illegal. 2013-12-11 10:54:06 -08:00
simd.rs
stack.rs Test fixes and rebase conflicts 2013-12-25 23:10:46 -08:00
sync.rs std: Get stdtest all passing again 2013-12-24 19:59:52 -08:00