MailCore / mailcore2

MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.
Other
2.59k stars 623 forks source link

Replaces OSSpinLock with pthread_mutex_t #1953

Open akkrat opened 1 year ago

akkrat commented 1 year ago

Fixing #1785 pthread_mutex_t was chosen because 1) it's already using on some platforms 2) os_unfair_lock must be allocated on the heap so it couldn't be used as c++ class member (Concurrent Programming With GCD in Swift 3 or SO)

dinhvh commented 1 year ago

pthread_mutex_t is too slow. We need to use something faster on iOS / macOS.

akkrat commented 1 year ago

libetpan uses pthread_mutex_t too The other alternatives (such as dispatch semaphore or os_unfair_lock) are not much faster than pthread_mutex_t

dinhvh commented 1 year ago

https://gist.github.com/steipete/36350a8a60693d440954b95ea6cbbafc

In my opnion os_unfair_lock would work.

On Mon, Sep 5, 2022 at 8:57 AM Artur Protska @.***> wrote:

libetpan uses pthread_mutex_t too The other alternatives (such as dispatch semaphore or os_unfair_lock) are not much faster than pthread_mutex_t

— Reply to this email directly, view it on GitHub https://github.com/MailCore/mailcore2/pull/1953#issuecomment-1237246741, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACRDCGCM4GBXSZ2O5PKSO3V4YKALANCNFSM57PFLEQA . You are receiving this because you commented.Message ID: @.***>

-- DINH Viêt Hoà