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