]> Cypherpunks repositories - gostls13.git/commit
misc/cgo/testcarchive: avoid possible pthread_create race
authorIan Lance Taylor <iant@golang.org>
Fri, 6 May 2016 18:32:18 +0000 (11:32 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 6 May 2016 19:15:52 +0000 (19:15 +0000)
commita1813ae0a091e1b880c0d3472112d2c725c2fa18
treede1983acb42cf01730d8732bd792e9d156eedbe6
parentf0e2d32fde77ad03616304ab42b8c7426cf3a350
misc/cgo/testcarchive: avoid possible pthread_create race

The old code assumed that the thread ID set by pthread_create would be
available in the newly created thread.  While that is clearly true
eventually, it is not necessarily true immediately.  Rather than try to
pass down the thread ID, just call pthread_self in the created thread.

Fixes #15576 (I hope).

Change-Id: Ic07086b00e4fd5676c04719a299c583320da64a1
Reviewed-on: https://go-review.googlesource.com/22880
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
misc/cgo/testcarchive/main4.c