// Code generated by cmd/cgo; DO NOT EDIT.

//line /home/evie/packages/go/go-1.18-0/go/misc/cgo/testtls/tls.go:1:1
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package cgotlstest

// #include <pthread.h>
// extern void setTLS(int);
// extern int getTLS();
import _ "unsafe"

import (
	"runtime"
	"testing"
)

func testTLS(t *testing.T) {
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	if val := ( /*line :21:12*/_Cfunc_getTLS /*line :21:19*/)(); val != 0 {
		t.Fatalf("at start, C.getTLS() = %#x, want 0", val)
	}

	const keyVal = 0x1234
	( /*line :26:2*/_Cfunc_setTLS /*line :26:9*/)(keyVal)
	if val := ( /*line :27:12*/_Cfunc_getTLS /*line :27:19*/)(); val != keyVal {
		t.Fatalf("at end, C.getTLS() = %#x, want %#x", val, keyVal)
	}
}
