lvsti / CEF.swift

Swift bindings for the Chromium Embedded Framework
BSD 3-Clause "New" or "Revised" License
94 stars 29 forks source link

Atomic ref count #23

Closed infrom-software closed 6 years ago

infrom-software commented 6 years ago

While pthread works, using atomics would be better.(not an issue but a todo)

lvsti commented 6 years ago

you mean like this? https://github.com/lvsti/CEF.swift/pull/25

infrom-software commented 6 years ago

More like atomic_ref_count.h from Chromium or cef_atomicops_x86_gcc.h from CEF/Linux since cef_atomicops_mac.h deprecated (in 10.13 at least).

lvsti commented 6 years ago

what difference would that make compared to the OS-provided locking mechanisms?

infrom-software commented 6 years ago

... or of C11. (Sorry, stupid me) Simpler, faster. No need to lock/block/wait here.

infrom-software commented 6 years ago

add_ref, release and has_one_ref from cef_base_ref_counted_t to be implemented directly in C using . Just a suggestion.

lvsti commented 6 years ago

if you refer to the refcounting in CEFMarshaller then I'm afraid it has to be locking since it's not just about testing and changing a number but also setting/releasing the reference to self. But if you have a solution, feel free to submit a PR.

infrom-software commented 6 years ago

You're right. I didn't realise that.