Skip to content

Synchronization bugs in RtlEnterCriticalSection/RtlLeaveCriticalSection #1

Description

@Markos-Th09

Due to synchronization bugs in the implementation of critical sections which I have not been able to exactly pinpoint, various deadlocks have been observed exclusively on iOS in the execution blocks of RtlEnterCriticalSection and RtlLeaveCriticalSection. Under the conditions of the iOS kernel scheduler, which more aggressively parks and context-switches threads compared to desktop operating systems, various thread starvation patterns and deadlocks have been observed.

Prior to updating the implementation, the synchronization logic failed consistently across build configurations:

  • Debug Builds: Permanent hang on the initial scene loading layout.
  • Release Builds: Immediate deadlock at the early initialization sequence of the runtime application launch.

However, even after these changes, an infinite loading screen occurs when exiting back to the main menu.

Possible next steps

  • Try conservative std::mutex / std::condition_variable implementation to see if it is resolved
  • Profile thread interactions during scene teardown using Xcode Instruments.
  • If conservative implementation works, try to refine the current implementation using atomics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions