github.com/huandu/go@v0.0.0-20151114150818-04e615e41150/misc/cgo/testso/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 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 }