-
Notifications
You must be signed in to change notification settings - Fork 65
Update MovableLock SPI implementation #870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7c10895
5c03203
b3b6b18
3126cc4
e917ad5
f40de9e
f4a88ca
e5a39d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| // MovableLock.h | ||
| // OpenSwiftUI | ||
| // | ||
| // Audited for 3.5.2 | ||
| // Audited for 6.5.4 | ||
| // Status: Complete | ||
|
|
||
| #ifndef MovableLock_h | ||
|
|
@@ -15,34 +15,37 @@ OPENSWIFTUI_ASSUME_NONNULL_BEGIN | |
|
|
||
| typedef struct MovableLock_s { | ||
| pthread_mutex_t mutex; | ||
| pthread_cond_t cond1; | ||
| pthread_cond_t cond2; | ||
| pthread_cond_t cond3; | ||
| pthread_t main; | ||
| pthread_t owner; | ||
| uint32_t level; | ||
| uint32_t unknown; | ||
| void (* _Nullable function)(const void *context); | ||
| const void * _Nullable context; | ||
| bool unknown4; | ||
| bool unknown5; | ||
| pthread_cond_t lock_condition; | ||
| pthread_cond_t main_callback_condition; | ||
| pthread_cond_t broadcast_condition; | ||
| pthread_t main_thread; | ||
| pthread_t owner_thread; | ||
| uint32_t lock_level; | ||
| uint32_t waiter_count; | ||
| void (* _Nullable main_callback)(const void *main_callback_context); | ||
| const void * _Nullable main_callback_context; | ||
| bool main_callback_pending; | ||
| bool main_thread_waiting; | ||
| } MovableLock_t; | ||
|
|
||
| typedef MovableLock_t *MovableLock __attribute((swift_newtype(struct))); | ||
|
|
||
| OPENSWIFTUI_EXPORT | ||
| OPENSWIFTUI_REFINED_FOR_SWIFT | ||
| MovableLock _MovableLockCreate(void) OPENSWIFTUI_SWIFT_NAME(MovableLock.create()); | ||
| MovableLock _MovableLockCreate(void) OPENSWIFTUI_SWIFT_NAME(MovableLock.init()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sources/OpenSwiftUI_SPI/Util/MovableLock.h:33: Removing Severity: low 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||
|
|
||
| OPENSWIFTUI_EXPORT | ||
| OPENSWIFTUI_REFINED_FOR_SWIFT | ||
| void _MovableLockDestroy(MovableLock lock) OPENSWIFTUI_SWIFT_NAME(MovableLock.destroy(self:)); | ||
|
|
||
| bool _MovableLockIsOwner(MovableLock lock) OPENSWIFTUI_SWIFT_NAME(getter:MovableLock.isOwner(self:)); | ||
| bool _MovableLockIsOuterMostOwner(MovableLock lock) OPENSWIFTUI_SWIFT_NAME(getter:MovableLock.isOuterMostOwner(self:)); | ||
|
|
||
| bool _MovableLockIsOutermostOwner(MovableLock lock) OPENSWIFTUI_SWIFT_NAME(getter:MovableLock.isOutermostOwner(self:)); | ||
|
|
||
| void _MovableLockLock(MovableLock lock) OPENSWIFTUI_SWIFT_NAME(MovableLock.lock(self:)); | ||
|
|
||
| void _MovableLockUnlock(MovableLock lock) OPENSWIFTUI_SWIFT_NAME(MovableLock.unlock(self:)); | ||
| void _MovableLockSyncMain(MovableLock lock, const void *context, void (*function)(const void *context)) OPENSWIFTUI_SWIFT_NAME(MovableLock.syncMain(self:_:function:)); | ||
|
|
||
| void _MovableLockSyncMain(MovableLock lock, const void *main_callback_context, void (*main_callback)(const void *main_callback_context)) OPENSWIFTUI_SWIFT_NAME(MovableLock.syncMain(self:_:function:)); | ||
|
|
||
| void _MovableLockWait(MovableLock lock) OPENSWIFTUI_SWIFT_NAME(MovableLock.wait(self:)); | ||
|
|
||
| void _MovableLockBroadcast(MovableLock lock) OPENSWIFTUI_SWIFT_NAME(MovableLock.broadcast(self:)); | ||
|
|
||
| OPENSWIFTUI_ASSUME_NONNULL_END | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sources/OpenSwiftUI_SPI/Util/MovableLock.c:68:
[[clang::noinline]]is used as a standalone statement attribute here; depending on the C standard/toolchain this can be rejected or downgraded to a warning (which may become an error under-Werror). If the intent is to prevent inlining, it’s safer to ensurenoinlineis applied in a compiler-supported way for C (also applies to the other occurrences in this PR).Severity: medium
Other Locations
Sources/OpenSwiftUI_SPI/Util/MovableLock.c:124Sources/OpenSwiftUI_SPI/Util/MovableLock.c:169Sources/OpenSwiftUI_SPI/Util/MovableLock.c:172🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.