Skip to content

Commit a240e01

Browse files
committed
errinj: introduce ERROR_INJECT_TERMINATE() macro
It is conditional injection that terminates execution calling assert(0) if given condition is true. It is quite useful since allows us to emulate situations when instance is suddenly shutdown: due to sigkill for example. Needed for tarantool#5823
1 parent 4d6e2b7 commit a240e01

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/lib/core/errinj.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ void errinj_set_with_environment_vars(void);
208208
#define ERROR_INJECT_RETURN(ID) ERROR_INJECT(ID, return -1)
209209
#define ERROR_INJECT_SLEEP(ID) ERROR_INJECT_WHILE(ID, usleep(1000))
210210
#define ERROR_INJECT_YIELD(ID) ERROR_INJECT_WHILE(ID, fiber_sleep(0.001))
211+
#define ERROR_INJECT_TERMINATE(ID) ERROR_INJECT(ID, assert(0))
211212

212213
#if defined(__cplusplus)
213214
} /* extern "C" */

0 commit comments

Comments
 (0)