summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchristian linke <christian.linke@bmw.de>2012-10-12 16:49:34 +0200
committerchristian linke <christian.linke@bmw.de>2012-10-12 16:49:34 +0200
commitc170f0547cd8d4f1a48de807e34269857563b136 (patch)
treef14562570b09a734ed7c498b765b574573c74f5d
parentbeec2584c3bff46ae7aa0bf57389fb6dadf33917 (diff)
downloadaudiomanager-c170f0547cd8d4f1a48de807e34269857563b136.tar.gz
* Call ControlRundown on receiving SIGTERM.
Signed-off-by: christian linke <christian.linke@bmw.de>
-rw-r--r--AudioManagerDaemon/include/CAmControlSender.h6
-rw-r--r--AudioManagerDaemon/src/CAmControlSender.cpp3
-rwxr-xr-xAudioManagerDaemon/src/main.cpp5
3 files changed, 13 insertions, 1 deletions
diff --git a/AudioManagerDaemon/include/CAmControlSender.h b/AudioManagerDaemon/include/CAmControlSender.h
index 2a9c0fa..65db2c8 100644
--- a/AudioManagerDaemon/include/CAmControlSender.h
+++ b/AudioManagerDaemon/include/CAmControlSender.h
@@ -86,6 +86,11 @@ public:
void confirmRoutingReady() ;
void confirmCommandRundown() ;
void confirmRoutingRundown() ;
+ static void CallsetControllerRundown()
+ {
+ if (mInstance)
+ mInstance->setControllerRundown();
+ }
#ifdef UNIT_TEST
friend class IAmControlBackdoor;
@@ -93,6 +98,7 @@ public:
private:
void* mlibHandle; //!< pointer to the loaded control plugin interface
IAmControlSend* mController; //!< pointer to the ControlSend interface
+ static CAmControlSender* mInstance;
};
}
diff --git a/AudioManagerDaemon/src/CAmControlSender.cpp b/AudioManagerDaemon/src/CAmControlSender.cpp
index 77cec9f..82446ce 100644
--- a/AudioManagerDaemon/src/CAmControlSender.cpp
+++ b/AudioManagerDaemon/src/CAmControlSender.cpp
@@ -34,6 +34,8 @@ namespace am
#define REQUIRED_INTERFACE_VERSION_MAJOR 1 //!< major interface version. All versions smaller than this will be rejected
#define REQUIRED_INTERFACE_VERSION_MINOR 0 //!< minor interface version. All versions smaller than this will be rejected
+CAmControlSender* CAmControlSender::mInstance=NULL;
+
CAmControlSender::CAmControlSender(std::string controlPluginFile) :
mlibHandle(NULL), //
mController(NULL)
@@ -45,6 +47,7 @@ CAmControlSender::CAmControlSender(std::string controlPluginFile) :
}
else if (!controlPluginFile.empty())
{
+ mInstance=this;
IAmControlSend* (*createFunc)();
createFunc = getCreateFunction<IAmControlSend*()>(controlPluginFile, mlibHandle);
assert(createFunc!=NULL);
diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp
index b9eade1..b5eed1c 100755
--- a/AudioManagerDaemon/src/main.cpp
+++ b/AudioManagerDaemon/src/main.cpp
@@ -267,7 +267,10 @@ static void signalHandler(int sig, siginfo_t *siginfo, void *context)
logError("signal handler was called, exit now...");
gDispatchDone = 1;
//todo: maually fire the mainloop
- exit(1);
+ CAmControlSender::CallsetControllerRundown();
+
+ //todo: Maybe we can remove this here in a productive system. For now it's handy :-)
+ exit (-1);
}
void mainProgram()