• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
3  */
4 
5 #ifndef TST_CHECKPOINT_FN__
6 #define TST_CHECKPOINT_FN__
7 
8 /*
9  * Checkpoint initializaton, must be done first.
10  *
11  * NOTE: tst_tmpdir() must be called beforehand.
12  */
13 void tst_checkpoint_init(const char *file, const int lineno,
14 			 void (*cleanup_fn)(void));
15 
16 /*
17  * Waits for wakeup.
18  *
19  * @id: Checkpoint id, positive number
20  * @msec_timeout: Timeout in milliseconds, 0 == no timeout
21  */
22 int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout);
23 
24 /*
25  * Wakes up sleeping process(es)/thread(s).
26  *
27  * @id: Checkpoint id, positive number
28  * @nr_wake: Number of processes/threads to wake up
29  * @msec_timeout: Timeout in milliseconds, 0 == no timeout
30  */
31 int tst_checkpoint_wake(unsigned int id, unsigned int nr_wake,
32                         unsigned int msec_timeout);
33 
34 void tst_safe_checkpoint_wait(const char *file, const int lineno,
35                               void (*cleanup_fn)(void), unsigned int id,
36 			      unsigned int msec_timeout);
37 
38 void tst_safe_checkpoint_wake(const char *file, const int lineno,
39                               void (*cleanup_fn)(void), unsigned int id,
40                               unsigned int nr_wake);
41 
42 #endif /* TST_CHECKPOINT_FN__ */
43