1// Copyright 2016 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 5package main 6 7/* 8char *geterror() { 9 return "cgo error"; 10} 11*/ 12import "C" 13import ( 14 "fmt" 15) 16 17func init() { 18 register("CgoPanicDeadlock", CgoPanicDeadlock) 19} 20 21type cgoError struct{} 22 23func (cgoError) Error() string { 24 fmt.Print("") // necessary to trigger the deadlock 25 return C.GoString(C.geterror()) 26} 27 28func CgoPanicDeadlock() { 29 panic(cgoError{}) 30} 31