Tuesday, 20 November 2007

g_thread_cancel?

Richard, Matthias, no need to speculate. Just search for cancel in the gthread bugs. Redirect comments to the mailing-list posts mentioned in the bugzilla. Easy.

(I did ask that question a number of years ago for Totem)
(Matthias, I sent a mail to Richard months ago telling him his blog sucks for not allowing anonymous comments)

3 comments:

Mathias Hasselmann said...

Well, actually I hesitated before answering Richard via Planet GNOME, and I considered mailing him. Finally urge combined with lazzyness (to figure out his e-mail address) won.

Viêt Hoà said...

Hello,

You should rather consider do yourself a clean cancel of the thread pthread_cancel() has a difficult semantic to implement and pthread_kill() will not be a clean solution.
Resource allocated during the thread have to be cleaned up properly.

You'd rather do the following (with proper locks) :

thread_run()
{
while (has_some_work_to_do) {
if (cancelled)
return;
do things;
}
}
thread_cancel()
{
cancelled = true;
}

hadess said...

Viêt Hoà, you already pasted that in Mathias' blog...