diff options
Diffstat (limited to 'src/svm/svm_fifo.c')
-rw-r--r-- | src/svm/svm_fifo.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c index e7a1188d591..b53a2e294f7 100644 --- a/src/svm/svm_fifo.c +++ b/src/svm/svm_fifo.c @@ -845,6 +845,29 @@ svm_fifo_init_pointers (svm_fifo_t * f, u32 pointer) f->head = f->tail = pointer % f->nitems; } +void +svm_fifo_add_subscriber (svm_fifo_t * f, u8 subscriber) +{ + if (f->n_subscribers >= SVM_FIFO_MAX_EVT_SUBSCRIBERS) + return; + f->subscribers[f->n_subscribers++] = subscriber; +} + +void +svm_fifo_del_subscriber (svm_fifo_t * f, u8 subscriber) +{ + int i; + + for (i = 0; i < f->n_subscribers; i++) + { + if (f->subscribers[i] != subscriber) + continue; + f->subscribers[i] = f->subscribers[f->n_subscribers - 1]; + f->n_subscribers--; + break; + } +} + #endif /* * fd.io coding-style-patch-verification: ON |