[AD] Potential uthreads hang on cleanup? |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: [AD] Potential uthreads hang on cleanup?
- From: Chris <chris.kcat@xxxxxxxxxx>
- Date: Thu, 09 Dec 2004 21:54:31 -0800
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:return-path:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:x-enigmail-version:x-enigmail-supports:content-type; b=ZBIAVns+CxqOUGRpJ1jkBUwioerf6+TYlAon1LCoNuPiTcyRUp4GEtm1fJIt4GN7qhh5vuSQQIKUnxaaiYMu9hAhJ9aULcsNmbVi2l/ZvOdXEff9V6FBqs9OkoE6FrVcuM2cojgyoO8SXtNXBBR9TymovlJ35luEZqXVEmllI6Q=
As detailed here:
http://www.allegro.cc/forums/view_thread.php?_id=438553#target
it seems pthread_cancel has some problems shutting down on some systems.
The poster says it returns what resolves to "Resource temporarily
unavailable", although my man pages say pthread_cancel can only fail if
the requested thread doesn't exist, so I'm not really sure what's going
on or what the right way to deal with it is. In either case, I attached
a simple patch that fixes his issue.
Index: src/unix/uthreads.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/unix/uthreads.c,v
retrieving revision 1.19
diff -u -r1.19 uthreads.c
--- src/unix/uthreads.c 29 Nov 2004 07:58:34 -0000 1.19
+++ src/unix/uthreads.c 10 Dec 2004 05:45:36 -0000
@@ -151,7 +151,8 @@
static void bg_man_pthreads_exit(void)
{
if (thread) {
- pthread_cancel(thread);
+ while(pthread_cancel(thread))
+ ;
pthread_join(thread, NULL);
pthread_mutex_destroy(&cli_mutex);
pthread_cond_destroy(&cli_cond);