summaryrefslogtreecommitdiffstats
path: root/src/Daemon/CrashWatcher.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-08-26 19:40:28 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-08-26 19:40:28 +0200
commitcaf38bbfe3279b9bea861e4d5b70f3c50c6e1755 (patch)
tree5ed7f83b0bdb584422f2e99489cfc81aac645500 /src/Daemon/CrashWatcher.cpp
parentfca6fa371006186d12a720cd48c270789c67d2e6 (diff)
downloadabrt-caf38bbfe3279b9bea861e4d5b70f3c50c6e1755.tar.gz
abrt-caf38bbfe3279b9bea861e4d5b70f3c50c6e1755.tar.xz
abrt-caf38bbfe3279b9bea861e4d5b70f3c50c6e1755.zip
add job ids (== thread ids) to warning/update DBus messages
renamed: comm_layer_inner_warning -> warn_client comm_layer_inner_status -> update_client Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Daemon/CrashWatcher.cpp')
-rw-r--r--src/Daemon/CrashWatcher.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp
index 07dfa126..4473659e 100644
--- a/src/Daemon/CrashWatcher.cpp
+++ b/src/Daemon/CrashWatcher.cpp
@@ -118,6 +118,20 @@ static void *create_report(void *arg)
{
thread_data_t *thread_data = (thread_data_t *) arg;
map_crash_info_t crashReport;
+
+ /* Ugly hack.
+ * We use DBus signals to talk to clients.
+ * If the report thread emits a signal with embedded job id before
+ * main thread returns this job id as a CreateReport() DBus call's
+ * return value, the client will not be able to understand
+ * that this signal is for its job.
+ * By no means this is the right solution. The right one would be
+ * to ensure that CreateReport() DBus call returns _before_
+ * we continue here. This will need substantial surgery
+ * on our DBus machinery. TODO.
+ */
+ usleep(10*1000);
+
log("Creating report...");
try
{
@@ -172,22 +186,25 @@ static void *create_report(void *arg)
/* Bogus value. pthreads require us to return void* */
return NULL;
}
-uint64_t CreateReport_t(const std::string &pUUID,const std::string &pUID, const std::string &pSender)
+uint64_t CreateReport_t(const std::string& pUUID, const std::string& pUID, const std::string& pSender)
{
thread_data_t *thread_data = (thread_data_t *)xzalloc(sizeof(thread_data_t));
thread_data->UUID = xstrdup(pUUID.c_str());
thread_data->UID = xstrdup(pUID.c_str());
thread_data->dest = xstrdup(pSender.c_str());
- if (pthread_create(&(thread_data->thread_id), NULL, create_report, (void *)thread_data) != 0)
+ if (pthread_create(&thread_data->thread_id, NULL, create_report, (void *)thread_data) != 0)
{
free(thread_data->UUID);
free(thread_data->UID);
free(thread_data->dest);
free(thread_data);
- throw CABRTException(EXCEP_FATAL, "CCrashWatcher::CreateReport_t(): Cannot create thread!");
+ /* The only reason this may happen is system-wide resource starvation,
+ * or ulimit is exceeded (someoune floods us with CreateReport() Dbus calls?)
+ */
+ error_msg("cannot create thread");
+ return 0;
}
- //FIXME: we don't use this value anymore, so fix the API
- return 0;
+ return uint64_t(thread_data->thread_id);
}
bool DeleteDebugDump(const std::string& pUUID, const std::string& pUID)