From 3f5d20573bd0aac953bd2db2d72997ff44365caf Mon Sep 17 00:00:00 2001 From: enselic Date: Sat, 13 Sep 2008 11:39:35 +0000 Subject: The global int pointer 'Running' is just a hack for global access of ProgData::running. We can get rid of this global. include/rmdtypes.h: Put ProgData in JackData so that the libjack stuff can access progam state. src/recordmydesktop.c: Initialize ProgData member of JackData. src/rmd_jack.c: Use ProgData instead of the global. src/register_callbacks.[ch]: Pass ProgData to the registering of signal handlers and put a local version of the Running-global hack in this file. src/rmd_rescue.c: Get rid of Running-logic and pass ProgData to RegisterCallbacks() src/rmdthreads.c: Pass ProgData to RegisterCallbacks() src/initialize_data.c: Get rid of Running-logic. include/recordmydesktop.h: Remove the Running-global. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@528 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/src/register_callbacks.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'recordmydesktop/src/register_callbacks.c') diff --git a/recordmydesktop/src/register_callbacks.c b/recordmydesktop/src/register_callbacks.c index 79ee3fe..c16f7b1 100644 --- a/recordmydesktop/src/register_callbacks.c +++ b/recordmydesktop/src/register_callbacks.c @@ -30,6 +30,11 @@ #include "register_callbacks.h" +// There seem to be no way of passing user data to the signal handler, +// so hack around not being able to pass ProgData to them +static int *pdata_running = NULL; + + static void SetPaused(int signum) { PauseStateChanged = 1; @@ -39,7 +44,9 @@ static void SetRunning(int signum) { if (!Paused){ - *Running = 0; + if (pdata_running != NULL) { + *pdata_running = 0; + } if (signum == SIGABRT) { Aborted = 1; @@ -47,11 +54,14 @@ static void SetRunning(int signum) { } } -void RegisterCallbacks(ProgArgs *prog_data) { +void RegisterCallbacks(ProgData *pata) { struct sigaction pause_act; struct sigaction end_act; + // Is there some way to pass pata to the signal handlers? + pdata_running = &pata->running; + // Setup pause_act sigfillset(&pause_act.sa_mask); pause_act.sa_flags = SA_RESTART; -- cgit v1.2.1