diff options
-rw-r--r-- | src/til_stream.c | 7 | ||||
-rw-r--r-- | src/til_tap.h | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/til_stream.c b/src/til_stream.c index 60c28d4..4109d8f 100644 --- a/src/til_stream.c +++ b/src/til_stream.c @@ -163,11 +163,14 @@ int til_stream_tap(til_stream_t *stream, const void *owner, const void *owner_fo return -1; } - /* this looks to be our pipe, but we're not driving */ + /* this looks to be the pipe, but we're not driving, should we be? */ + if (pipe->driving_tap->inactive) + pipe->driving_tap = tap; + *(tap->ptr) = pipe->driving_tap->elems; pthread_mutex_unlock(&stream->mutex); - return 1; + return (tap != pipe->driving_tap); } } } diff --git a/src/til_tap.h b/src/til_tap.h index 6fa47f4..4c0c589 100644 --- a/src/til_tap.h +++ b/src/til_tap.h @@ -69,7 +69,8 @@ typedef struct til_tap_t { size_t n_elems; /* when > 1, *ptr is an array of n_elems elements. Otherwise individual variable. */ void *elems; /* points at the first element of type type, may or may not be an array of them */ const char *name; - uint32_t name_hash; /* cached hash of name, set once @ initialization */ + uint32_t name_hash; /* cached hash of name, set once @ initialization */ + unsigned inactive:1; /* used to signal when a tap should be replaced as driver */ } til_tap_t; /* just some forward declared higher-order vector and matrix types for the wrappers */ |