Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mpegts service: add asserts to master/slave linking
  • Loading branch information
perexg committed Jan 22, 2016
1 parent 045f739 commit b756409
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/input/mpegts/mpegts_service.c
Expand Up @@ -965,6 +965,8 @@ mpegts_service_link ( mpegts_service_t *master, mpegts_service_t *slave )
{
pthread_mutex_lock(&slave->s_stream_mutex);
pthread_mutex_lock(&master->s_stream_mutex);
assert(LIST_SAFE_ENTRY(master, s_masters_link));
assert(LIST_SAFE_ENTRY(slave, s_slaves_link));
LIST_INSERT_HEAD(&slave->s_masters, master, s_masters_link);
LIST_INSERT_HEAD(&master->s_slaves, slave, s_slaves_link);
pthread_mutex_unlock(&master->s_stream_mutex);
Expand Down
3 changes: 3 additions & 0 deletions src/queue.h
Expand Up @@ -36,6 +36,9 @@
LIST_ENTRY_INIT(elm, field); \
}

#define LIST_SAFE_ENTRY(elm, field) \
((elm)->field.le_next == NULL && (elm)->field.le_prev == NULL)

#define LIST_MOVE(newhead, oldhead, field) do { \
if((oldhead)->lh_first) { \
(oldhead)->lh_first->field.le_prev = &(newhead)->lh_first; \
Expand Down

0 comments on commit b756409

Please sign in to comment.