• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef TST_CHECKPOINT_FN__
19 #define TST_CHECKPOINT_FN__
20 
21 /*
22  * Checkpoint initializaton, must be done first.
23  *
24  * NOTE: tst_tmpdir() must be called beforehand.
25  */
26 void tst_checkpoint_init(const char *file, const int lineno,
27 			 void (*cleanup_fn)(void));
28 
29 /*
30  * Waits for wakeup.
31  *
32  * @id: Checkpoint id, possitive number
33  * @msec_timeout: Timeout in miliseconds, 0 == no timeout
34  */
35 int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout);
36 
37 /*
38  * Wakes up sleeping process(es)/thread(s).
39  *
40  * @id: Checkpoint id, possitive number
41  * @nr_wake: Number of processes/threads to wake up
42  * @msec_timeout: Timeout in miliseconds, 0 == no timeout
43  */
44 int tst_checkpoint_wake(unsigned int id, unsigned int nr_wake,
45                         unsigned int msec_timeout);
46 
47 void tst_safe_checkpoint_wait(const char *file, const int lineno,
48                               void (*cleanup_fn)(void), unsigned int id,
49 			      unsigned int msec_timeout);
50 
51 void tst_safe_checkpoint_wake(const char *file, const int lineno,
52                               void (*cleanup_fn)(void), unsigned int id,
53                               unsigned int nr_wake);
54 
55 #endif /* TST_CHECKPOINT_FN__ */
56