[xiph-commits] r12383 - trunk/oss2pulse/src/oss2pulse

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Jan 23 09:48:38 PST 2007


Author: xiphmont
Date: 2007-01-23 09:48:36 -0800 (Tue, 23 Jan 2007)
New Revision: 12383

Modified:
   trunk/oss2pulse/src/oss2pulse/dsp.c
   trunk/oss2pulse/src/oss2pulse/mixer.c
Log:
It is absolutely vital to detach any fire-and-forget threads---
especially if they're being created at a rate of 100/second.



Modified: trunk/oss2pulse/src/oss2pulse/dsp.c
===================================================================
--- trunk/oss2pulse/src/oss2pulse/dsp.c	2007-01-23 12:00:08 UTC (rev 12382)
+++ trunk/oss2pulse/src/oss2pulse/dsp.c	2007-01-23 17:48:36 UTC (rev 12383)
@@ -604,10 +604,12 @@
 }
 
 static int dsp_open(struct fusd_file_info* file){
-  pthread_t dummy;
+  pthread_t thread;
   debug(DEBUG_LEVEL_NORMAL, __FILE__": dsp_open()\n");
-  if(pthread_create(&dummy,NULL,dsp_open_thread,file))
+  if(pthread_create(&thread,NULL,dsp_open_thread,file))
     dsp_open_thread(file);
+  else
+    pthread_detach(thread);
   return -FUSD_NOREPLY;
 }
 
@@ -962,7 +964,7 @@
 
 static int dsp_ioctl(struct fusd_file_info *file, int request, void *argp){
   struct fd_info* i = file->private_data;
-  pthread_t dummy;
+  pthread_t thread;
 
   if(i == NULL) return -EBADFD;
   if(i->unusable) return -EBADFD;
@@ -970,8 +972,10 @@
   i->ioctl_request = request;
   i->ioctl_argp = argp;
   
-  if(pthread_create(&dummy,NULL,dsp_ioctl_thread,file))
+  if(pthread_create(&thread,NULL,dsp_ioctl_thread,file))
     dsp_ioctl_thread(file);
+  else
+    pthread_detach(thread);
 
   return -FUSD_NOREPLY;
 }
@@ -1028,10 +1032,13 @@
 }
 
 static int dsp_close(struct fusd_file_info* file){
-  pthread_t dummy;
+  pthread_t thread;
   debug(DEBUG_LEVEL_NORMAL, __FILE__": close()\n");
-  if(pthread_create(&dummy,NULL,dsp_close_thread,file))
+  if(pthread_create(&thread,NULL,dsp_close_thread,file))
     dsp_close_thread(file);
+  else
+    pthread_detach(thread);
+
   return -FUSD_NOREPLY;
 }
 

Modified: trunk/oss2pulse/src/oss2pulse/mixer.c
===================================================================
--- trunk/oss2pulse/src/oss2pulse/mixer.c	2007-01-23 12:00:08 UTC (rev 12382)
+++ trunk/oss2pulse/src/oss2pulse/mixer.c	2007-01-23 17:48:36 UTC (rev 12383)
@@ -178,10 +178,12 @@
 }
 
 static int mixer_open(struct fusd_file_info* file){
-  pthread_t dummy;
+  pthread_t thread;
   debug(DEBUG_LEVEL_NORMAL, __FILE__": mixer_open()\n");
-  if(pthread_create(&dummy,NULL,mixer_open_thread,file))
+  if(pthread_create(&thread,NULL,mixer_open_thread,file))
     mixer_open_thread(file);
+  else
+    pthread_detach(thread);
   return -FUSD_NOREPLY;
 }
 
@@ -384,7 +386,7 @@
 
 static int mixer_ioctl(struct fusd_file_info *file, int request, void *argp){
   struct fd_info* i = file->private_data;
-  pthread_t dummy;
+  pthread_t thread;
 
   if(i == NULL) return -EBADFD;
   if(i->unusable) return -EBADFD;
@@ -392,8 +394,10 @@
   i->ioctl_request = request;
   i->ioctl_argp = argp;
   
-  if(pthread_create(&dummy,NULL,mixer_ioctl_thread,file))
+  if(pthread_create(&thread,NULL,mixer_ioctl_thread,file))
     mixer_ioctl_thread(file);
+  else
+    pthread_detach(thread);
 
   return -FUSD_NOREPLY;
 }



More information about the commits mailing list