+Fri May 18 21:10:38 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Do not uninitialize u.m.threads atomic int in finish but in
+ free. Fixes crash on any platform using atomic operations
+ using mutexes (like Symbian). Affected file is
+ lib/silcutil/silcfsm.c.
+
+ * Fixes Symbian scheduler wakeup synchronization. Affected file
+ is lib/silcutil/symbian/silcsymbianscheduler.c.
+
Fri May 18 18:10:36 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
* Fixed nickname formatting to handle already formatted nicknames
if (f->thread && f->u.t.event)
silc_fsm_event_free(f->u.t.event);
+ if (!f->thread)
+ silc_atomic_uninit32(&f->u.m.threads);
+
silc_free(f);
}
silc_mutex_free(fsm->u.m.lock);
fsm->u.m.lock = NULL;
}
- silc_atomic_uninit32(&fsm->u.m.threads);
/* Call the destructor callback. */
if (fsm->destructor)
Cancel();
}
- /* Wakeup */
+ /* Wakeup. This is called with scheduler locked. */
void Wakeup(TThreadId thread_id)
{
if (wake_signal)
{
SILC_LOG_DEBUG(("Wakeup scheduler"));
+ /* We need to synchronize with calls to Wakeup() */
+ silc_mutex_lock(schedule->lock);
+
/* Wakeup scheduler */
timer->Cancel();
timer->After(0);
iStatus = KRequestPending;
SetActive();
+
+ silc_mutex_unlock(schedule->lock);
}
virtual void DoCancel()
{
-
+ wake_signal = TRUE;
}
RThread thread;
TThreadId id;
SilcSymbianScheduler *timer;
+ SilcSchedule schedule;
unsigned int wake_signal : 1;
};
internal->wakeup->id = RThread().Id();
internal->wakeup->thread.Open(internal->wakeup->id);
internal->wakeup->timer = internal->timer;
+ internal->wakeup->schedule = schedule;
/* Start Active Scheduler */
s->Start();
return 0;
if (timeout == -1)
- timeout = 0;
+ return -2;
/* Set the timeout value */
at_timeout.HomeTime();
at_timeout += (TTimeIntervalMicroSeconds32)timeout;
/* Schedule the timeout */
+ if (internal->timer->IsActive())
+ internal->timer->Cancel();
internal->timer->At(at_timeout);
/* Return special "ignore" value. Causes the scheduler to just break
/* Nothing to do */
}
+#ifdef __WINSCW__
EXPORT_C const SilcScheduleOps schedule_ops =
+#else
+const SilcScheduleOps schedule_ops =
+#endif /* __WINSCW__ */
{
silc_schedule_internal_init,
silc_schedule_internal_uninit,