summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/northbound_sysrepo.c14
-rw-r--r--lib/workqueue.c21
-rw-r--r--lib/workqueue.h7
3 files changed, 18 insertions, 24 deletions
diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c
index 8a64347871..f035ac8611 100644
--- a/lib/northbound_sysrepo.c
+++ b/lib/northbound_sysrepo.c
@@ -515,7 +515,7 @@ static int frr_sr_notification_send(const char *xpath, struct list *arguments)
}
}
- ret = sr_event_notif_send(session, xpath, values, values_cnt, 0, 0);
+ ret = sr_notif_send(session, xpath, values, values_cnt, 0, 0);
if (ret != SR_ERR_OK) {
flog_err(EC_LIB_LIBSYSREPO,
"%s: sr_event_notif_send() failed for xpath %s",
@@ -532,7 +532,8 @@ static void frr_sr_read_cb(struct thread *thread)
int fd = THREAD_FD(thread);
int ret;
- ret = sr_process_events(module->sr_subscription, session, NULL);
+ ret = sr_subscription_process_events(module->sr_subscription, session,
+ NULL);
if (ret != SR_ERR_OK) {
flog_err(EC_LIB_LIBSYSREPO, "%s: sr_fd_event_process(): %s",
__func__, sr_strerror(ret));
@@ -578,9 +579,9 @@ static int frr_sr_subscribe_state(const struct lysc_node *snode, void *arg)
DEBUGD(&nb_dbg_client_sysrepo, "sysrepo: providing data to '%s'",
nb_node->xpath);
- ret = sr_oper_get_items_subscribe(
- session, snode->module->name, nb_node->xpath, frr_sr_state_cb,
- NULL, SR_SUBSCR_CTX_REUSE, &module->sr_subscription);
+ ret = sr_oper_get_subscribe(session, snode->module->name,
+ nb_node->xpath, frr_sr_state_cb, NULL, 0,
+ &module->sr_subscription);
if (ret != SR_ERR_OK)
flog_err(EC_LIB_LIBSYSREPO, "sr_oper_get_items_subscribe(): %s",
sr_strerror(ret));
@@ -605,8 +606,7 @@ static int frr_sr_subscribe_rpc(const struct lysc_node *snode, void *arg)
nb_node->xpath);
ret = sr_rpc_subscribe(session, nb_node->xpath, frr_sr_config_rpc_cb,
- NULL, 0, SR_SUBSCR_CTX_REUSE,
- &module->sr_subscription);
+ NULL, 0, 0, &module->sr_subscription);
if (ret != SR_ERR_OK)
flog_err(EC_LIB_LIBSYSREPO, "sr_rpc_subscribe(): %s",
sr_strerror(ret));
diff --git a/lib/workqueue.c b/lib/workqueue.c
index 92869594dd..c703de90b3 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -103,8 +103,7 @@ void work_queue_free_and_null(struct work_queue **wqp)
{
struct work_queue *wq = *wqp;
- if (wq->thread != NULL)
- thread_cancel(&(wq->thread));
+ THREAD_OFF(wq->thread);
while (!work_queue_empty(wq)) {
struct work_queue_item *item = work_queue_last_item(wq);
@@ -122,16 +121,14 @@ void work_queue_free_and_null(struct work_queue **wqp)
bool work_queue_is_scheduled(struct work_queue *wq)
{
- return (wq->thread != NULL);
+ return thread_is_scheduled(wq->thread);
}
static int work_queue_schedule(struct work_queue *wq, unsigned int delay)
{
/* if appropriate, schedule work queue thread */
- if (CHECK_FLAG(wq->flags, WQ_UNPLUGGED) && (wq->thread == NULL)
- && !work_queue_empty(wq)) {
- wq->thread = NULL;
-
+ if (CHECK_FLAG(wq->flags, WQ_UNPLUGGED) &&
+ !thread_is_scheduled(wq->thread) && !work_queue_empty(wq)) {
/* Schedule timer if there's a delay, otherwise just schedule
* as an 'event'
*/
@@ -144,7 +141,8 @@ static int work_queue_schedule(struct work_queue *wq, unsigned int delay)
&wq->thread);
/* set thread yield time, if needed */
- if (wq->thread && wq->spec.yield != THREAD_YIELD_TIME_SLOT)
+ if (thread_is_scheduled(wq->thread) &&
+ wq->spec.yield != THREAD_YIELD_TIME_SLOT)
thread_set_yield_time(wq->thread, wq->spec.yield);
return 1;
} else
@@ -215,10 +213,7 @@ void workqueue_cmd_init(void)
*/
void work_queue_plug(struct work_queue *wq)
{
- if (wq->thread)
- thread_cancel(&(wq->thread));
-
- wq->thread = NULL;
+ THREAD_OFF(wq->thread);
UNSET_FLAG(wq->flags, WQ_UNPLUGGED);
}
@@ -250,8 +245,6 @@ void work_queue_run(struct thread *thread)
assert(wq);
- wq->thread = NULL;
-
/* calculate cycle granularity:
* list iteration == 1 run
* listnode processing == 1 cycle
diff --git a/lib/workqueue.h b/lib/workqueue.h
index 39202dcda7..27fb1383eb 100644
--- a/lib/workqueue.h
+++ b/lib/workqueue.h
@@ -157,7 +157,8 @@ static inline void work_queue_item_dequeue(struct work_queue *wq,
* user must fill in the spec of the returned work queue before adding
* anything to it
*/
-extern struct work_queue *work_queue_new(struct thread_master *, const char *);
+extern struct work_queue *work_queue_new(struct thread_master *m,
+ const char *queue_name);
/* destroy work queue */
/*
@@ -174,10 +175,10 @@ extern void work_queue_plug(struct work_queue *wq);
/* unplug the queue, allow it to be drained again */
extern void work_queue_unplug(struct work_queue *wq);
-bool work_queue_is_scheduled(struct work_queue *);
+bool work_queue_is_scheduled(struct work_queue *wq);
/* Helpers, exported for thread.c and command.c */
-extern void work_queue_run(struct thread *);
+extern void work_queue_run(struct thread *thread);
extern void workqueue_cmd_init(void);