Public bug reported:
Binary package hint: xmms-alarm
There is a race condition at the start of alarm_start_thread() when the
condition of the while loop is first evaluated, since the global
start_tid may not yet have been initialized with the return value of
alarm_thread_create(). This access to start_tid should be protected by
a mutex.
Here comes the patch :
diff -ru xmms-alarm-0.3.7/src/alarm.c xmms-alarm-0.3.7-repaired/src/alarm.c
--- xmms-alarm-0.3.7/src/alarm.c 2005-04-09 02:20:12.000000000 +0200
+++ xmms-alarm-0.3.7-repaired/src/alarm.c 2007-10-30 07:50:54.000000000
+0100
@@ -57,6 +57,7 @@
static pthread_t start_tid; /* thread id of alarm loop */
static pthread_t stop_tid; /* thread id of stop loop */
static pthread_mutex_t fader_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t start_lock = PTHREAD_MUTEX_INITIALIZER;
static GeneralPlugin alarm_plugin;
@@ -880,6 +881,9 @@
unsigned int play_start = 0;
guint today;
+ pthread_mutex_lock(&start_lock);
+ pthread_mutex_unlock(&start_lock);
+
while(start_tid != 0)
{
/* sit around and wait for the faders to not be doing anything */
@@ -1080,7 +1084,9 @@
alarm_read_config();
/* start the main thread running */
+ pthread_mutex_lock(&start_lock);
start_tid = alarm_thread_create(alarm_start_thread, NULL, 1);
+ pthread_mutex_unlock(&start_lock);
Please apply and notify upstream (if any still alive).
** Affects: xmms-alarm (Ubuntu)
Importance: Undecided
Status: New
--
Race condition prevents working completely
https://bugs.launchpad.net/bugs/158573
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs