Added a flag to the exit signal

This boolean can be used to differentiate between restarts and exits.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Chris Newton 2011-03-20 16:20:02 -06:00 committed by Uli Schlachter
parent 07e63bd564
commit 471babcc70
3 changed files with 9 additions and 6 deletions

View File

@ -57,9 +57,10 @@ static char *awesome_argv;
/** Call before exiting.
*/
void
awesome_atexit(void)
awesome_atexit(bool restart)
{
signal_object_emit(globalconf.L, &global_signals, "exit", 0);
lua_pushboolean(globalconf.L, restart);
signal_object_emit(globalconf.L, &global_signals, "exit", 1);
a_dbus_cleanup();
@ -276,7 +277,7 @@ exit_on_signal(EV_P_ ev_signal *w, int revents)
void
awesome_restart(void)
{
awesome_atexit();
awesome_atexit(true);
a_exec(awesome_argv);
}
@ -571,7 +572,7 @@ main(int argc, char **argv)
ev_ref(globalconf.loop);
ev_io_stop(globalconf.loop, &xio);
awesome_atexit();
awesome_atexit(false);
return EXIT_SUCCESS;
}

View File

@ -22,8 +22,10 @@
#ifndef AWESOME_AWESOME_H
#define AWESOME_AWESOME_H
#include <stdbool.h>
void awesome_restart(void);
void awesome_atexit(void);
void awesome_atexit(bool restart);
#endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

2
luaa.c
View File

@ -87,7 +87,7 @@ luaA_exec(lua_State *L)
{
const char *cmd = luaL_checkstring(L, 1);
awesome_atexit();
awesome_atexit(false);
a_exec(cmd);
return 0;