]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/workqueue.h
2 * Copyright (C) 2017 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it would be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20 * This code was adapted from repair/threads.h.
27 typedef void workqueue_func_t(struct workqueue
*wq
, uint32_t index
, void *arg
);
29 struct workqueue_item
{
30 struct workqueue
*queue
;
31 struct workqueue_item
*next
;
32 workqueue_func_t
*function
;
40 struct workqueue_item
*next_item
;
41 struct workqueue_item
*last_item
;
43 pthread_cond_t wakeup
;
44 unsigned int item_count
;
45 unsigned int thread_count
;
49 int workqueue_create(struct workqueue
*wq
, void *wq_ctx
,
50 unsigned int nr_workers
);
51 int workqueue_add(struct workqueue
*wq
, workqueue_func_t fn
,
52 uint32_t index
, void *arg
);
53 void workqueue_destroy(struct workqueue
*wq
);
55 #endif /* _WORKQUEUE_H_ */