Make Span and Symbol implement Send and Sync
This commit is contained in:
parent
f53d4af223
commit
3fa69c935d
2 changed files with 10 additions and 2 deletions
|
@ -184,8 +184,12 @@ impl SpanData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The interner in thread-local, so `Span` shouldn't move between threads.
|
// The interner is pointed to by a thread local value which is only set on the main thread
|
||||||
|
// with parallelization is disabled. So we don't allow Span to transfer between threads
|
||||||
|
// to avoid panics and other errors, even though it would be memory safe to do so.
|
||||||
|
#[cfg(not(parallel_queries))]
|
||||||
impl !Send for Span {}
|
impl !Send for Span {}
|
||||||
|
#[cfg(not(parallel_queries))]
|
||||||
impl !Sync for Span {}
|
impl !Sync for Span {}
|
||||||
|
|
||||||
impl PartialOrd for Span {
|
impl PartialOrd for Span {
|
||||||
|
|
|
@ -83,8 +83,12 @@ impl Decodable for Ident {
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct Symbol(u32);
|
pub struct Symbol(u32);
|
||||||
|
|
||||||
// The interner in thread-local, so `Symbol` shouldn't move between threads.
|
// The interner is pointed to by a thread local value which is only set on the main thread
|
||||||
|
// with parallelization is disabled. So we don't allow Symbol to transfer between threads
|
||||||
|
// to avoid panics and other errors, even though it would be memory safe to do so.
|
||||||
|
#[cfg(not(parallel_queries))]
|
||||||
impl !Send for Symbol { }
|
impl !Send for Symbol { }
|
||||||
|
#[cfg(not(parallel_queries))]
|
||||||
impl !Sync for Symbol { }
|
impl !Sync for Symbol { }
|
||||||
|
|
||||||
impl Symbol {
|
impl Symbol {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue