]> Cypherpunks repositories - gostls13.git/commit
runtime/cgo: remove memset in _cgo_sys_thread_start on linux
authorTobias Klauser <tklauser@distanz.ch>
Thu, 5 May 2022 18:46:29 +0000 (20:46 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Fri, 6 May 2022 15:32:04 +0000 (15:32 +0000)
commit7f71e1fc28f03afe987881c679a925a6f7e99cac
tree7c73f1bc41dfec110f6f8a318b77022e057fde14
parent119da6358bf8cc01bb8bc7556d616bd0fe723ad4
runtime/cgo: remove memset in _cgo_sys_thread_start on linux

pthread_attr_init in glibc and musl libc already explicitly clear the
pthread_attr argument before setting it, see
https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_attr_init.c
and https://git.musl-libc.org/cgit/musl/log/src/thread/pthread_attr_init.c

It looks like pthread_attr_init has been implemented like this for a
long time in both libcs. The comment and memset in _cgo_sys_thread_start
probably stem from a time where not all libcs did the explicit memset in
pthread_attr_init.

Also, the memset in _cgo_sys_thread_start is not performed on all linux
platforms further indicating that this isn't an issue anymore.

Change-Id: I920148b5d24751195ced7af5bb7c52a7f8293259
Reviewed-on: https://go-review.googlesource.com/c/go/+/404275
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/runtime/cgo/gcc_darwin_arm64.c
src/runtime/cgo/gcc_linux_386.c
src/runtime/cgo/gcc_linux_arm.c
src/runtime/cgo/gcc_linux_arm64.c
src/runtime/cgo/gcc_linux_mips64x.c
src/runtime/cgo/gcc_linux_mipsx.c
src/runtime/cgo/gcc_linux_riscv64.c