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 }
func (h Host) VmInfo() (*VmInfo, os.Error) { vmstat := new(C.vm_statistics_data_t) nummsg := C.mach_msg_type_number_t(C.HOST_VM_INFO_COUNT) ret := C.host_statistics(C.host_t(h), C.HOST_VM_INFO, (*C.integer_t)(unsafe.Pointer(vmstat)), &nummsg) if ret != 0 { return nil, fmt.Errorf("host_statistics: %s", C.mach_error_string(C.mach_error_t(ret))) } return &VmInfo{uint64(vmstat.pageins), uint64(vmstat.pageouts)}, nil }