Skip to content

Commit 2dcb1ba

Browse files
committed
restrict log feature to the instantiation threading class
while this feature is not restricted to any threading class, i have some doubt about RT concern and threading issue
1 parent 8571f3f commit 2dcb1ba

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

log/src/lib.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,20 @@ unsafe impl<'a> UriBound for Log<'a> {
8787
}
8888

8989
unsafe impl<'a> Feature for Log<'a> {
90-
// Note: this feature can be used in any threading class and doesn't seems to have thready
91-
// unsafty, but you are supposed to only use the trace log in rt context
92-
unsafe fn from_feature_ptr(feature: *const c_void, _class: ThreadingClass) -> Option<Self> {
90+
// Note: this feature can be used in any threading class but:
91+
// * i have a doubt about it's thread safety, can we assume the host provide this thread safety
92+
// since this feature can be used anywhere ?.
93+
// * i shouldn't be used in context where rt is a concern, that mean is audiothreadclass in
94+
// practice, but it's acceptable to use it for debugging purpose
95+
// So, at this time, i just giving access to it instanciation class
96+
unsafe fn from_feature_ptr(feature: *const c_void, class: ThreadingClass) -> Option<Self> {
97+
if class == ThreadingClass::Instantiation {
9398
(feature as *const lv2_sys::LV2_Log_Log)
9499
.as_ref()
95100
.map(|internal| Self { internal })
101+
} else {
102+
panic!("The log feature is only allowed in the indtantiation threading class");
103+
}
96104
}
97105
}
98106

0 commit comments

Comments
 (0)