Skip to content

Commit

Permalink
add functions locked_list_move and locked_list_move_tail
Browse files Browse the repository at this point in the history
  • Loading branch information
happyfish100 committed Dec 20, 2022
1 parent ee70efc commit aa2fc62
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions HISTORY
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

Version 1.65 2022-12-20
* locked_list.h: add functions locked_list_move and locked_list_move_tail

Version 1.64 2022-11-19
* shared_func.[hc]: normalize_path use type string_t for general purpose
* bugfixed: common_blocked_queue_[alloc|free]_node must use lock
Expand Down
16 changes: 16 additions & 0 deletions src/locked_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ extern "C" {
PTHREAD_MUTEX_UNLOCK(&list->lock);
}

static inline void locked_list_move(struct fc_list_head *obj,
FCLockedList *list)
{
PTHREAD_MUTEX_LOCK(&list->lock);
fc_list_move(obj, &list->head);
PTHREAD_MUTEX_UNLOCK(&list->lock);
}

static inline void locked_list_move_tail(struct fc_list_head *obj,
FCLockedList *list)
{
PTHREAD_MUTEX_LOCK(&list->lock);
fc_list_move_tail(obj, &list->head);
PTHREAD_MUTEX_UNLOCK(&list->lock);
}

static inline void locked_list_del(struct fc_list_head *old,
FCLockedList *list)
{
Expand Down

0 comments on commit aa2fc62

Please sign in to comment.