summaryrefslogtreecommitdiff
path: root/lib/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stream.c')
-rw-r--r--lib/stream.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/lib/stream.c b/lib/stream.c
index c67bc3c993..2e1a0193a2 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -28,6 +28,7 @@
#include "network.h"
#include "prefix.h"
#include "log.h"
+#include "frr_pthread.h"
#include "lib_errors.h"
DEFINE_MTYPE_STATIC(LIB, STREAM, "Stream")
@@ -186,14 +187,6 @@ size_t stream_resize_inplace(struct stream **sptr, size_t newsize)
return orig->size;
}
-size_t __attribute__((deprecated))stream_resize_orig(struct stream *s,
- size_t newsize)
-{
- assert("stream_resize: Switch code to use stream_resize_inplace" == NULL);
-
- return stream_resize_inplace(&s, newsize);
-}
-
size_t stream_get_getp(struct stream *s)
{
STREAM_VERIFY_SANE(s);
@@ -1144,11 +1137,9 @@ void stream_fifo_push(struct stream_fifo *fifo, struct stream *s)
void stream_fifo_push_safe(struct stream_fifo *fifo, struct stream *s)
{
- pthread_mutex_lock(&fifo->mtx);
- {
+ frr_with_mutex(&fifo->mtx) {
stream_fifo_push(fifo, s);
}
- pthread_mutex_unlock(&fifo->mtx);
}
/* Delete first stream from fifo. */
@@ -1178,11 +1169,9 @@ struct stream *stream_fifo_pop_safe(struct stream_fifo *fifo)
{
struct stream *ret;
- pthread_mutex_lock(&fifo->mtx);
- {
+ frr_with_mutex(&fifo->mtx) {
ret = stream_fifo_pop(fifo);
}
- pthread_mutex_unlock(&fifo->mtx);
return ret;
}
@@ -1196,11 +1185,9 @@ struct stream *stream_fifo_head_safe(struct stream_fifo *fifo)
{
struct stream *ret;
- pthread_mutex_lock(&fifo->mtx);
- {
+ frr_with_mutex(&fifo->mtx) {
ret = stream_fifo_head(fifo);
}
- pthread_mutex_unlock(&fifo->mtx);
return ret;
}
@@ -1220,11 +1207,9 @@ void stream_fifo_clean(struct stream_fifo *fifo)
void stream_fifo_clean_safe(struct stream_fifo *fifo)
{
- pthread_mutex_lock(&fifo->mtx);
- {
+ frr_with_mutex(&fifo->mtx) {
stream_fifo_clean(fifo);
}
- pthread_mutex_unlock(&fifo->mtx);
}
size_t stream_fifo_count_safe(struct stream_fifo *fifo)