File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -28,12 +28,22 @@ use super::OwnedJsObject;
28
28
/// OwnedJsValue wraps a Javascript value owned by the QuickJs runtime.
29
29
///
30
30
/// Guarantees cleanup of resources by dropping the value from the runtime.
31
+ ///
32
+ /// **Safety**:
33
+ ///
34
+ /// This type is `Send` and `Sync` only for convenience, since [OwnedJsValue](crate::OwnedJsValue)
35
+ /// itself is just a wrapper around a raw pointer. But any operation on the underlying raw pointer is unsafe.
36
+ /// Make sure using it in a same thread.
37
+ ///
31
38
pub struct OwnedJsValue {
32
39
context : * mut q:: JSContext ,
33
40
// FIXME: make private again, just for testing
34
41
pub ( crate ) value : q:: JSValue ,
35
42
}
36
43
44
+ unsafe impl Send for OwnedJsValue { }
45
+ unsafe impl Sync for OwnedJsValue { }
46
+
37
47
impl PartialEq for OwnedJsValue {
38
48
fn eq ( & self , other : & Self ) -> bool {
39
49
unsafe { q:: JS_VALUE_GET_PTR ( self . value ) == q:: JS_VALUE_GET_PTR ( other. value ) }
You can’t perform that action at this time.
0 commit comments