mirror of
https://github.com/danog/ext-php-rs.git
synced 2024-11-30 04:39:04 +01:00
Make ClassMetadata: Send + Sync
(#111)
This wasn't the case because of `PhantomData<T>` inside the metadata. Replacing this with `PhantomData<AtomicPtr<T>>` ensures that the metadata will always be `Send + Sync`.
This commit is contained in:
parent
c12dde1866
commit
8d37afc510
@ -85,7 +85,10 @@ pub struct ClassMetadata<T> {
|
|||||||
handlers: MaybeUninit<ZendObjectHandlers>,
|
handlers: MaybeUninit<ZendObjectHandlers>,
|
||||||
ce: AtomicPtr<ClassEntry>,
|
ce: AtomicPtr<ClassEntry>,
|
||||||
|
|
||||||
phantom: PhantomData<T>,
|
// `AtomicPtr` is used here because it is `Send + Sync`.
|
||||||
|
// fn() -> T could have been used but that is incompatible with const fns at
|
||||||
|
// the moment.
|
||||||
|
phantom: PhantomData<AtomicPtr<T>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> ClassMetadata<T> {
|
impl<T> ClassMetadata<T> {
|
||||||
|
Loading…
Reference in New Issue
Block a user