diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-07-06 14:42:53 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-07-06 18:57:29 -0700 |
| commit | 953ca274ae57f8edd12536a3dd15d134aa6e5576 (patch) | |
| tree | 7a0e889fbae7b525befefedcb5cb8f10820e7a47 /src/core/reap.h | |
| parent | 89cba92d13fbc5e059336fd054be30e50d8a2621 (diff) | |
| download | nng-953ca274ae57f8edd12536a3dd15d134aa6e5576.tar.gz nng-953ca274ae57f8edd12536a3dd15d134aa6e5576.tar.bz2 nng-953ca274ae57f8edd12536a3dd15d134aa6e5576.zip | |
fixes #568 Want a single reader/write lock on socket child objects
fixes #170 Make more use of reaper
This is a complete restructure/rethink of how child objects interact
with the socket. (This also backs out #576 as it turns out not to be
needed.) While 568 says reader/writer lock, for now we have settled
for a single writer lock. Its likely that this is sufficient.
Essentially we use the single socket lock to guard lists of the socket
children. We also use deferred deletion in the idhash to facilitate
teardown, which means endpoint closes are no longer synchronous.
We use the reaper to clean up objects when the reference count drops
to zero. We make a special exception for pipes, since they really
are not reference counted by their parents, and they are leaf objects
anyway.
We believe this addresses the main outstanding race conditions in
a much more correct and holistic way.
Note that endpoint shutdown is a little tricky, as it makes use of
atomic flags to guard against double entry, and against recursive
lock entry. This is something that would be nice to make a bit more
obvious, but what we have is safe, and the complexity is at least
confined to one place.
Diffstat (limited to 'src/core/reap.h')
| -rw-r--r-- | src/core/reap.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/core/reap.h b/src/core/reap.h index 843c8c9c..40c27a5d 100644 --- a/src/core/reap.h +++ b/src/core/reap.h @@ -38,6 +38,7 @@ typedef struct nni_reap_item { // part of a fully reapable graph; otherwise this can lead to an infinite // loop in the reap thread. extern void nni_reap(nni_reap_item *, nni_cb, void *); +extern void nni_reap_drain(void); extern int nni_reap_sys_init(void); extern void nni_reap_sys_fini(void); |
