-
Notifications
You must be signed in to change notification settings - Fork 97
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
RB: Call to sem_destroy_fn() without checking ref_count #8
Comments
I'll have a look at it. One concern I have is if the process that created the ringbuffer crashes then |
Certainly. A developer should be worry about it. Ringbuffers are asymmetric. I mean that only one side creates them with QB_RB_FLAG_CREATE. And only that side should destroy semaphores.
Thereby only the side with QB_RB_FLAG_CREATE destroys semaphores and unlinks shared files. |
I don't have a problem applying this patch (please send a patch to the mailing list). When I get a moment I want to look at using inotify on the mmap'ed file so in the non-creator side we But, yes, you patch does make the behavior more consistent. In the future if you have a patch please just post to the mailing list. There are others that Thanks |
Call to sem_destroy_fn() inside qb_rb_close() should be permitted iff previous call to qb_atomic_int_dec_and_test() returns 1. Otherwise sem_destroy_fn() destroys the semaphore even if the ringbuffer was opened without QB_RB_FLAG_CREATE flag.
However it seems to be more conceptually correct to test QB_RB_FLAG_CREATE in rb->flags.
Thus qb_rb_close() will look like
The text was updated successfully, but these errors were encountered: