pthread_attr_init() returning errors

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Apr 21 08:37:00 GMT 2016


On Apr 20 11:18, Ernie Rael wrote:
> On 4/20/2016 10:22 AM, Canham, Timothy K (348C) wrote:
> >I think I understand what happened now. The call to pthread_attr_init() is contained within a function we use to start threads. It is called successive times and it fails on the second call. It would appear that the stack entry gets laid out the exact same way as the previous call, so pthread_attr_init() sees the previous pthread_attr_t. I added a memset() of att and the issue went away. It looks like that is a good practice anyway.
> 
> Best practice might be using pthread_attr_destroy(attr).

Good point.  Not calling pthread_attr_destroy on abandoned
pthread_attr_t also results in memory leaks on Cygwin.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20160421/054bec86/attachment.sig>


More information about the Cygwin mailing list