Re: [CrystalSpace] #994: Call pthread_attr_destroy() after pthread_attr_init()

"CrystalSpace" <[email protected]> Tue, 30 Jul 2013 07:53:50 -0000
Newsgroups gmane.comp.graphics.crystalspace.tracker
Message-ID <[email protected]>
#994: Call pthread_attr_destroy() after pthread_attr_init()
---------------------------+------------------------------------------------
 Reporter:  ralphcampbell  |       Owner:  jorrit
     Type:  defect         |      Status:  new   
 Priority:  minor          |   Milestone:        
Component:  general        |     Version:  V2.1  
 Keywords:                 |  
---------------------------+------------------------------------------------
Description changed by sunshine:

Old description:

> According to the pthread_attr_init() manual page, pthread_attr_destroy()
> should be called.
> I ran valgrind on threadtest and did see a reduction in possibly lost
> records.
>

> {{{
> Index: libs/csutil/threading/pthread_thread.cpp
> ===================================================================
> --- libs/csutil/threading/pthread_thread.cpp    (revision 39535)
> +++ libs/csutil/threading/pthread_thread.cpp    (working copy)
> @@ -100,6 +100,7 @@
>        pthread_attr_init(&attr);
>        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
>        pthread_create(&threadHandle, &attr, proxyFunc, &param);
> +      pthread_attr_destroy(&attr);
>
>        startupBarrier.Wait ();
>
> }}}

New description:

 According to the `pthread_attr_init()` manual page,
 `pthread_attr_destroy()` should be called.
 I ran `valgrind` on `threadtest` and did see a reduction in possibly lost
 records.


 {{{
 #!diff
 Index: libs/csutil/threading/pthread_thread.cpp
 ===================================================================
 --- libs/csutil/threading/pthread_thread.cpp    (revision 39535)
 +++ libs/csutil/threading/pthread_thread.cpp    (working copy)
 @@ -100,6 +100,7 @@
        pthread_attr_init(&attr);
        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
        pthread_create(&threadHandle, &attr, proxyFunc, &param);
 +      pthread_attr_destroy(&attr);

        startupBarrier.Wait ();

 }}}

--

-- 
Ticket URL: <http://www.crystalspace3d.org/trac/CS/ticket/994#comment:1>
CrystalSpace <http://www.crystalspace3d.org/>
Free open-source 3D SDK.
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk