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

//line /home/xzl/work/golang-1.22/golang-1.22/src/cmd/cgo/internal/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

// extern const char *checkTLS();
// extern void setTLS(int);
// extern int getTLS();
import _ "unsafe"

import (
	"runtime"
	"testing"
)

func testTLS(t *testing.T) {
	if skip := ( /*line :18:13*/_Cfunc_checkTLS /*line :18:22*/)(); skip != nil {
		t.Skipf("%s", ( /*line :19:17*/_Cfunc_GoString /*line :19:26*/)(skip))
	}

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

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

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