cgoso_unix.go 412 B

1234567891011121314151617181920
  1. // Copyright 2014 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build aix dragonfly freebsd linux netbsd solaris
  5. package cgosotest
  6. /*
  7. extern int __thread tlsvar;
  8. int *getTLS() { return &tlsvar; }
  9. */
  10. import "C"
  11. func init() {
  12. if v := *C.getTLS(); v != 12345 {
  13. println("got", v)
  14. panic("BAD TLS value")
  15. }
  16. }