Thread attributes should be destroyed using the pthread_attr_destroy() (#13293)

On some OSes (such as FreeBSD or Solaris), pthread_attr_init allocate
memory. So it is necessary to deallocate that memory by using
pthread_attr_destroy.
This commit is contained in:
Hiroki Noda 2020-01-30 01:33:21 +09:00 • committed by GitHub
commit 3ab1274231
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -151,9 +151,11 @@ else:
tv_sec: Time
tv_nsec: clong
proc pthread_attr_init(a1: var Pthread_attr) {.
proc pthread_attr_init(a1: var Pthread_attr): cint {.
importc, header: pthreadh.}
proc pthread_attr_setstacksize(a1: var Pthread_attr, a2: int) {.
proc pthread_attr_setstacksize(a1: var Pthread_attr, a2: int): cint {.
importc, header: pthreadh.}
proc pthread_attr_destroy(a1: var Pthread_attr): cint {.
importc, header: pthreadh.}
proc pthread_create(a1: var SysThread, a2: var Pthread_attr,