HomePhabricator
Diffusion Comm aea53f271c7d

Implement synchronization mechanisms to address process, thread and class level…

Description

Implement synchronization mechanisms to address process, thread and class level concurrency.

Summary: This differential implements synchronisation mechanisms in NSE so that it is safe for two different threads to use the same NSE instance at the same time to process different notifications.

Test Plan:
I was never able to observe NotificationService run in parallel on separate threads to process different notifications so I am not sure if it is actually possible to properly test this differential. I tested that notifications work correctly in normal circumstances and that enforcing to call serviceExtensionTimeWillExpire by putting sleep() works correctly - notification is either displayed decrypted or with proper error message.

Discussion here: https://stackoverflow.com/questions/62566948/notification-service-extension-lifecycle, mentions that it is possible to launch two NSE processes with debugger. However inter-process safety is already tested by parent differentials. For this differential it would be necessary to have two NSE thread operate on one NSE class to process two different notifications. I think it is not possible to recreate such conditions.

Reviewers: tomek, ashoat, bartek

Reviewed By: tomek, ashoat, bartek

Differential Revision: https://phab.comm.dev/D8795

Details

Provenance
marcinAuthored on Aug 23 2023, 6:34 AM
Reviewer
tomek
Differential Revision
D8795: Implement synchronization mechanisms to address process, thread and class level concurrency.
Parents
rCOMMb0277def662b: Introduce memory monitoring in NSE
Branches
Unknown
Tags
Unknown