xref: /illumos-gate/usr/src/uts/common/fs/zfs/sys/zthr.h (revision 6a316e1f)
1667ec66fSSerapheim Dimitropoulos /*
2667ec66fSSerapheim Dimitropoulos  * CDDL HEADER START
3667ec66fSSerapheim Dimitropoulos  *
4667ec66fSSerapheim Dimitropoulos  * This file and its contents are supplied under the terms of the
5667ec66fSSerapheim Dimitropoulos  * Common Development and Distribution License ("CDDL"), version 1.0.
6667ec66fSSerapheim Dimitropoulos  * You may only use this file in accordance with the terms of version
7667ec66fSSerapheim Dimitropoulos  * 1.0 of the CDDL.
8667ec66fSSerapheim Dimitropoulos  *
9667ec66fSSerapheim Dimitropoulos  * A full copy of the text of the CDDL should have accompanied this
10667ec66fSSerapheim Dimitropoulos  * source. A copy of the CDDL is also available via the Internet at
11667ec66fSSerapheim Dimitropoulos  * http://www.illumos.org/license/CDDL.
12667ec66fSSerapheim Dimitropoulos  *
13667ec66fSSerapheim Dimitropoulos  * CDDL HEADER END
14667ec66fSSerapheim Dimitropoulos  */
15667ec66fSSerapheim Dimitropoulos 
16667ec66fSSerapheim Dimitropoulos /*
17*6a316e1fSSerapheim Dimitropoulos  * Copyright (c) 2017, 2018 by Delphix. All rights reserved.
18667ec66fSSerapheim Dimitropoulos  */
19667ec66fSSerapheim Dimitropoulos 
20667ec66fSSerapheim Dimitropoulos #ifndef _SYS_ZTHR_H
21667ec66fSSerapheim Dimitropoulos #define	_SYS_ZTHR_H
22667ec66fSSerapheim Dimitropoulos 
23667ec66fSSerapheim Dimitropoulos typedef struct zthr zthr_t;
24*6a316e1fSSerapheim Dimitropoulos typedef void (zthr_func_t)(void *, zthr_t *);
25667ec66fSSerapheim Dimitropoulos typedef boolean_t (zthr_checkfunc_t)(void *, zthr_t *);
26667ec66fSSerapheim Dimitropoulos 
27667ec66fSSerapheim Dimitropoulos extern zthr_t *zthr_create(zthr_checkfunc_t checkfunc,
28667ec66fSSerapheim Dimitropoulos     zthr_func_t *func, void *arg);
29de753e34SBrad Lewis extern zthr_t *zthr_create_timer(zthr_checkfunc_t *checkfunc,
30de753e34SBrad Lewis     zthr_func_t *func, void *arg, hrtime_t nano_wait);
31667ec66fSSerapheim Dimitropoulos extern void zthr_destroy(zthr_t *t);
32667ec66fSSerapheim Dimitropoulos 
33667ec66fSSerapheim Dimitropoulos extern void zthr_wakeup(zthr_t *t);
34*6a316e1fSSerapheim Dimitropoulos extern void zthr_cancel(zthr_t *t);
35667ec66fSSerapheim Dimitropoulos extern void zthr_resume(zthr_t *t);
36667ec66fSSerapheim Dimitropoulos 
37667ec66fSSerapheim Dimitropoulos extern boolean_t zthr_iscancelled(zthr_t *t);
38667ec66fSSerapheim Dimitropoulos 
39667ec66fSSerapheim Dimitropoulos #endif /* _SYS_ZTHR_H */
40