diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-09-11 00:50:47 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-09-11 22:20:33 +1000 |
| commit | 21ce41d42d6b86e482ec2e7fe01b3feb74dd4ea4 (patch) | |
| tree | 0d9f82bc7352ae3b0a913be17212f32beb0950f3 /src/rt | |
| parent | 5bb8aefed6994303aca9180958fcbd077c219cd1 (diff) | |
| download | rust-21ce41d42d6b86e482ec2e7fe01b3feb74dd4ea4.tar.gz rust-21ce41d42d6b86e482ec2e7fe01b3feb74dd4ea4.zip | |
extra: use a mutex to wrap linenoise calls and make them threadsafe.
Fixes #3921.
Diffstat (limited to 'src/rt')
| -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); |
