mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 07:44:48 -05:00
isolate: work around a rust compiler bug
This commit is contained in:
parent
4eeda9ea27
commit
97e08a6fab
1 changed files with 9 additions and 0 deletions
|
@ -14,6 +14,7 @@ use libc::c_void;
|
|||
use std;
|
||||
use std::ffi::CStr;
|
||||
use std::ffi::CString;
|
||||
use std::sync::atomic;
|
||||
use std::sync::mpsc;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
|
@ -193,6 +194,14 @@ impl Isolate {
|
|||
}
|
||||
|
||||
fn ntasks_decrement(&mut self) {
|
||||
// Do something that has no effect. This is done to work around a spooky
|
||||
// bug that happens in release mode only (presumably a compiler bug), that
|
||||
// causes nsize to unexpectedly contain zero.
|
||||
// TODO: remove this workaround when no longer necessary.
|
||||
#[allow(unused)]
|
||||
static UNUSED: atomic::AtomicIsize = atomic::AtomicIsize::new(0);
|
||||
UNUSED.fetch_add(self.ntasks as isize, atomic::Ordering::AcqRel);
|
||||
// Actually decrement the tasks counter here.
|
||||
self.ntasks = self.ntasks - 1;
|
||||
assert!(self.ntasks >= 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue