1 /*** 2 This file is part of PulseAudio. 3 4 Copyright 2022 Craig Howard 5 6 PulseAudio is free software; you can redistribute it and/or modify 7 it under the terms of the GNU Lesser General Public License as published 8 by the Free Software Foundation; either version 2.1 of the License, 9 or (at your option) any later version. 10 11 PulseAudio is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public License 17 along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 18 ***/ 19 20 #ifndef RESTART_MODULE_H 21 #define RESTART_MODULE_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 #include <pulse/timeval.h> 28 29 #include <pulsecore/core.h> 30 #include <pulsecore/thread-mq.h> 31 32 /* Init and exit callbacks of the module */ 33 typedef int (*init_cb)(pa_module *m); 34 typedef void (*done_cb)(pa_module *m); 35 /* Restart data structure */ 36 typedef struct pa_restart_data pa_restart_data; 37 38 /* Tears down the module using the done callback and schedules a restart after restart_usec. 39 * Returns a handle to the restart event. When the init callback finishes successfully during 40 * restart or when the restart should be cancelled, the restart event must be destroyed using 41 * pa_restart_free(). */ 42 pa_restart_data *pa_restart_module_reinit(pa_module *m, init_cb do_init, done_cb do_done, pa_usec_t restart_usec); 43 44 /* Free the restart event */ 45 void pa_restart_free(pa_restart_data *data); 46 47 #ifdef __cplusplus 48 } 49 #endif 50 51 #endif 52