Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atomic ref count #23

Closed
infrom-software opened this issue Nov 15, 2017 · 7 comments
Closed

Atomic ref count #23

infrom-software opened this issue Nov 15, 2017 · 7 comments

Comments

@infrom-software
Copy link

infrom-software commented Nov 15, 2017

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

@lvsti
Copy link
Owner

lvsti commented Nov 15, 2017

you mean like this? #25

@infrom-software
Copy link
Author

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
Copy link
Owner

lvsti commented Nov 15, 2017

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

@infrom-software
Copy link
Author

infrom-software commented Nov 15, 2017

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

@infrom-software
Copy link
Author

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

@lvsti
Copy link
Owner

lvsti commented Nov 15, 2017

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
Copy link
Author

infrom-software commented Nov 15, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants