示例#1
0
func (t *Thread) Halt() error {
	var kret C.kern_return_t
	kret = C.thread_suspend(t.os.thread_act)
	if kret != C.KERN_SUCCESS {
		return fmt.Errorf("could not suspend thread %d", t.Id)
	}
	t.running = false
	return nil
}
示例#2
0
func (t *Thread) halt() (err error) {
	kret := C.thread_suspend(t.os.threadAct)
	if kret != C.KERN_SUCCESS {
		errStr := C.GoString(C.mach_error_string(C.mach_error_t(kret)))
		err = fmt.Errorf("could not suspend thread %d %s", t.ID, errStr)
		return
	}
	return
}