github.com/kidsbmilk/gofronted_all@v0.0.0-20220701224323-6479d5976c5d/libgo/misc/cgo/testso/testdata/cgoso_unix.go (about)

     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  
     5  // +build aix dragonfly freebsd linux netbsd solaris
     6  
     7  package cgosotest
     8  
     9  /*
    10  extern int __thread tlsvar;
    11  int *getTLS() { return &tlsvar; }
    12  */
    13  import "C"
    14  
    15  func init() {
    16  	if v := *C.getTLS(); v != 12345 {
    17  		println("got", v)
    18  		panic("BAD TLS value")
    19  	}
    20  }