mirror of https://github.com/neutrinolabs/xrdp
Add g_set_alarm to set an alarm calling func after secs seconds
This commit is contained in:
parent
829378bba8
commit
1e5b42893c
|
@ -2808,6 +2808,22 @@ g_execlp3(const char *a1, const char *a2, const char *a3)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* does not work in win32 */
|
||||
unsigned int
|
||||
g_set_alarm(void (*func)(int), unsigned int secs)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return 0;
|
||||
#else
|
||||
/* Cancel any previous alarm to prevent a race */
|
||||
unsigned int rv = alarm(0);
|
||||
signal(SIGALRM, func);
|
||||
(void)alarm(secs);
|
||||
return rv;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* does not work in win32 */
|
||||
void
|
||||
|
|
|
@ -204,6 +204,7 @@ char *g_get_strerror(void);
|
|||
int g_get_errno(void);
|
||||
int g_execvp(const char *p1, char *args[]);
|
||||
int g_execlp3(const char *a1, const char *a2, const char *a3);
|
||||
unsigned int g_set_alarm(void (*func)(int), unsigned int secs);
|
||||
void g_signal_child_stop(void (*func)(int));
|
||||
void g_signal_segfault(void (*func)(int));
|
||||
void g_signal_hang_up(void (*func)(int));
|
||||
|
|
Loading…
Reference in New Issue