dora icon indicating copy to clipboard operation
dora copied to clipboard

feat(c/node): Make dora_next_event thread-safe

Open SanjayUG opened this issue 9 months ago • 0 comments

Feat: Make dora_next_event Thread-Safe

Which issue does this PR close?

  • Closes #540

Rationale for this change

This change allows multiple threads to safely call dora_next_event concurrently while maintaining existing safety guarantees. The updates ensure that the DoraContext fields are accessed in a thread-safe manner.

What changes are included in this PR?

  • feat(c/node): Make dora_next_event thread-safe
    • Wrap DoraContext fields in Arc<Mutex<>> for thread-safe access
    • Update dora_next_event to use shared references and mutex locking
    • Add comprehensive thread-safety documentation
    • Make dora_send_output thread-safe
    • Add proper error handling for mutex lock failures

Are these changes tested?

Yes, the changes have been tested to ensure that dora_next_event and dora_send_output can be called safely from multiple threads without causing race conditions or deadlocks.

Are there any user-facing changes?

No, there are no user-facing changes as this update is related to internal thread-safety improvements.

Are there any breaking changes to public APIs?

No, there are no breaking changes to public APIs.

SanjayUG avatar Mar 19 '25 17:03 SanjayUG