File: threads.h

package info (click to toggle)
xfsprogs 4.9.0+nmu1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 8,012 kB
  • ctags: 10,574
  • sloc: ansic: 110,850; sh: 3,804; makefile: 863; python: 126
file content (47 lines) | stat: -rw-r--r-- 847 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef	_XFS_REPAIR_THREADS_H_
#define	_XFS_REPAIR_THREADS_H_

void	thread_init(void);

struct  work_queue;

typedef void work_func_t(struct work_queue *, xfs_agnumber_t, void *);

typedef struct work_item {
	struct work_item	*next;
	work_func_t		*function;
	struct work_queue	*queue;
	xfs_agnumber_t		agno;
	void			*arg;
} work_item_t;

typedef struct  work_queue {
	work_item_t		*next_item;
	work_item_t		*last_item;
	int			item_count;
	int			thread_count;
	pthread_t		*threads;
	xfs_mount_t		*mp;
	pthread_mutex_t		lock;
	pthread_cond_t		wakeup;
	int			terminate;
} work_queue_t;

void
create_work_queue(
	work_queue_t		*wq,
	xfs_mount_t		*mp,
	int			nworkers);

void
queue_work(
	work_queue_t		*wq,
	work_func_t 		func,
	xfs_agnumber_t 		agno,
	void			*arg);

void
destroy_work_queue(
	work_queue_t		*wq);

#endif	/* _XFS_REPAIR_THREADS_H_ */