MCPcopy Create free account
hub / github.com/F-Stack/f-stack / enableWatchdog

Function enableWatchdog

app/redis-6.2.6/src/debug.c:1944–1964  ·  view source on GitHub ↗

Enable the software watchdog with the specified period in milliseconds. */

Source from the content-addressed store, hash-verified

1942
1943/* Enable the software watchdog with the specified period in milliseconds. */
1944void enableWatchdog(int period) {
1945 int min_period;
1946
1947 if (server.watchdog_period == 0) {
1948 struct sigaction act;
1949
1950 /* Watchdog was actually disabled, so we have to setup the signal
1951 * handler. */
1952 sigemptyset(&act.sa_mask);
1953 act.sa_flags = SA_SIGINFO;
1954 act.sa_sigaction = watchdogSignalHandler;
1955 sigaction(SIGALRM, &act, NULL);
1956 }
1957 /* If the configured period is smaller than twice the timer period, it is
1958 * too short for the software watchdog to work reliably. Fix it now
1959 * if needed. */
1960 min_period = (1000/server.hz)*2;
1961 if (period < min_period) period = min_period;
1962 watchdogScheduleSignal(period); /* Adjust the current timer. */
1963 server.watchdog_period = period;
1964}
1965
1966/* Disable the software watchdog. */
1967void disableWatchdog(void) {

Callers 1

configSetCommandFunction · 0.85

Calls 2

watchdogScheduleSignalFunction · 0.85
sigactionClass · 0.70

Tested by

no test coverage detected