1
// Copyright 2013 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.
7
// #include <pthread.h>
8
// extern void setTLS(int);
9
// extern int getTLS();
17
func testTLS(t *testing.T) {
18
var keyVal C.int = 1234
20
runtime.LockOSThread()
21
defer runtime.UnlockOSThread()
22
C.setTLS(C.int(keyVal))
23
storedVal := C.getTLS()
25
if storedVal != keyVal {
26
t.Fatalf("stored %d want %d", storedVal, keyVal)