diff options
| author | bors <bors@rust-lang.org> | 2013-09-12 04:36:06 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-12 04:36:06 -0700 |
| commit | 0a2d3c5a6f3bbd5f8cd8e3361995d5fa6c4d1e73 (patch) | |
| tree | df63170dd1385f7f4b5d23dd95d9bb02faa5196a /src/rt/rust_builtin.cpp | |
| parent | 4825db44c81ca2b122282dfb59aa705ad2475e5d (diff) | |
| parent | a9184975da62769dfccbca73fb9bd554298a4d36 (diff) | |
| download | rust-0a2d3c5a6f3bbd5f8cd8e3361995d5fa6c4d1e73.tar.gz rust-0a2d3c5a6f3bbd5f8cd8e3361995d5fa6c4d1e73.zip | |
auto merge of #9096 : huonw/rust/linenoise, r=brson
- Wrap calls into linenoise in a mutex so that the functions don't have to be `unsafe` any more (fixes #3921)
- Stop leaking every line that linenoise reads.
- Handle the situation of `rl::complete(some_function); do spawn { rl::read(""); }` which would crash (`fail!` that turned into an abort, possibly due to failing with the lock locked) when the user attempted to tab-complete anything.
- Add a test for the various functions; it has to be run by hand to verify anything works, but it won't bitrot.
Diffstat (limited to 'src/rt/rust_builtin.cpp')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 03a17d2c2ef..1871e7f36b3 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -633,6 +633,18 @@ rust_drop_env_lock() { env_lock.unlock(); } +static lock_and_signal linenoise_lock; + +extern "C" CDECL void +rust_take_linenoise_lock() { + linenoise_lock.lock(); +} + +extern "C" CDECL void +rust_drop_linenoise_lock() { + linenoise_lock.unlock(); +} + extern "C" CDECL unsigned int rust_valgrind_stack_register(void *start, void *end) { return VALGRIND_STACK_REGISTER(start, end); |
