]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - libfrog/workqueue.h
1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
6 #ifndef __LIBFROG_WORKQUEUE_H__
7 #define __LIBFROG_WORKQUEUE_H__
13 typedef void workqueue_func_t(struct workqueue
*wq
, uint32_t index
, void *arg
);
15 struct workqueue_item
{
16 struct workqueue
*queue
;
17 struct workqueue_item
*next
;
18 workqueue_func_t
*function
;
26 struct workqueue_item
*next_item
;
27 struct workqueue_item
*last_item
;
29 pthread_cond_t wakeup
;
30 unsigned int item_count
;
31 unsigned int thread_count
;
36 int workqueue_create(struct workqueue
*wq
, void *wq_ctx
,
37 unsigned int nr_workers
);
38 int workqueue_add(struct workqueue
*wq
, workqueue_func_t fn
,
39 uint32_t index
, void *arg
);
40 int workqueue_terminate(struct workqueue
*wq
);
41 void workqueue_destroy(struct workqueue
*wq
);
43 #endif /* __LIBFROG_WORKQUEUE_H__ */