Revision: 53668
          http://brlcad.svn.sourceforge.net/brlcad/?rev=53668&view=rev
Author:   brlcad
Date:     2012-11-14 06:02:58 +0000 (Wed, 14 Nov 2012)
Log Message:
-----------
call pthread_attr_destroy() when we're done with threads to ensure memory is 
released.

Modified Paths:
--------------
    brlcad/trunk/src/libbu/parallel.c

Modified: brlcad/trunk/src/libbu/parallel.c
===================================================================
--- brlcad/trunk/src/libbu/parallel.c   2012-11-13 21:52:10 UTC (rev 53667)
+++ brlcad/trunk/src/libbu/parallel.c   2012-11-14 06:02:58 UTC (rev 53668)
@@ -1003,8 +1003,7 @@
        pthread_attr_init(&attrs);
        pthread_attr_setstacksize(&attrs, 10*1024*1024);
 
-       if (pthread_create(&thread, &attrs,
-                          (void *(*)(void *))parallel_interface, NULL)) {
+       if (pthread_create(&thread, &attrs, (void *(*)(void 
*))parallel_interface, NULL)) {
            fprintf(stderr, "ERROR: bu_parallel: thr_create(0x0, 0x0, 0x%lx, 
0x0, 0, 0x%lx) failed on processor %d\n",
                    (unsigned long int)parallel_interface, (unsigned long 
int)&thread, x);
            bu_log("ERROR: bu_parallel: thr_create(0x0, 0x0, 0x%lx, 0x0, 0, %p) 
failed on processor %d\n",
@@ -1019,6 +1018,8 @@
            thread_tbl[nthreadc] = thread;
            nthreadc++;
        }
+       /* done with the attributes after create */
+       pthread_attr_destroy(&attrs);
     }
 
 
@@ -1050,6 +1051,7 @@
            /* badness happened */
            fprintf(stderr, "pthread_join(thread_tbl[%d]=%p) ret=%d\n", x, 
(void *)thread_tbl[x], ret);
        }
+
        nthreade++;
        thread_tbl[x] = (rt_thread_t)-1;
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to