unminitSignals()
}
+// Called from exitm, but not from drop, to undo the effect of thread-owned
+// resources in minit, semacreate, or elsewhere. Do not take locks after calling this.
+func mdestroy(mp *m) {
+}
+
func sigtramp()
//go:nosplit
unminitSignals()
}
+// Called from exitm, but not from drop, to undo the effect of thread-owned
+// resources in minit, semacreate, or elsewhere. Do not take locks after calling this.
+func mdestroy(mp *m) {
+}
+
// tstart is a function descriptor to _tstart defined in assembly.
var tstart funcDescriptor
}
}
+// Called from exitm, but not from drop, to undo the effect of thread-owned
+// resources in minit, semacreate, or elsewhere. Do not take locks after calling this.
+func mdestroy(mp *m) {
+}
+
//go:nosplit
func osyield() {
usleep(1)
unminitSignals()
}
+// Called from exitm, but not from drop, to undo the effect of thread-owned
+// resources in minit, semacreate, or elsewhere. Do not take locks after calling this.
+func mdestroy(mp *m) {
+}
+
func sigtramp()
type sigactiont struct {
unminitSignals()
}
+// Called from exitm, but not from drop, to undo the effect of thread-owned
+// resources in minit, semacreate, or elsewhere. Do not take locks after calling this.
+func mdestroy(mp *m) {
+}
+
func sigtramp()
type sigactiont struct {
func unminit() {
}
+// Called from exitm, but not from drop, to undo the effect of thread-owned
+// resources in minit, semacreate, or elsewhere. Do not take locks after calling this.
+func mdestroy(mp *m) {
+}
+
func osinit() {
ncpu = 1
getg().m.procid = 2
unminitSignals()
}
+// Called from exitm, but not from drop, to undo the effect of thread-owned
+// resources in minit, semacreate, or elsewhere. Do not take locks after calling this.
+func mdestroy(mp *m) {
+}
+
//#ifdef GOARCH_386
//#define sa_handler k_sa_handler
//#endif
unminitSignals()
}
+// Called from exitm, but not from drop, to undo the effect of thread-owned
+// resources in minit, semacreate, or elsewhere. Do not take locks after calling this.
+func mdestroy(mp *m) {
+}
+
func sigtramp()
type sigactiont struct {
unminitSignals()
}
+// Called from exitm, but not from drop, to undo the effect of thread-owned
+// resources in minit, semacreate, or elsewhere. Do not take locks after calling this.
+func mdestroy(mp *m) {
+}
+
func sigtramp()
type sigactiont struct {
func unminit() {
}
+// Called from exitm, but not from drop, to undo the effect of thread-owned
+// resources in minit, semacreate, or elsewhere. Do not take locks after calling this.
+func mdestroy(mp *m) {
+}
+
var sysstat = []byte("/dev/sysstat\x00")
func getproccount() int32 {
throw("runtime.minit: duplicatehandle failed")
}
+ mp := getg().m
+ lock(&mp.threadLock)
+ mp.thread = thandle
+
// Configure usleep timer, if possible.
- var timer uintptr
- if haveHighResTimer {
- timer = createHighResTimer()
- if timer == 0 {
+ if mp.highResTimer == 0 && haveHighResTimer {
+ mp.highResTimer = createHighResTimer()
+ if mp.highResTimer == 0 {
print("runtime: CreateWaitableTimerEx failed; errno=", getlasterror(), "\n")
throw("CreateWaitableTimerEx when creating timer failed")
}
}
-
- mp := getg().m
- lock(&mp.threadLock)
- mp.thread = thandle
- mp.highResTimer = timer
unlock(&mp.threadLock)
// Query the true stack base from the OS. Currently we're
func unminit() {
mp := getg().m
lock(&mp.threadLock)
- stdcall1(_CloseHandle, mp.thread)
- mp.thread = 0
+ if mp.thread != 0 {
+ stdcall1(_CloseHandle, mp.thread)
+ mp.thread = 0
+ }
+ unlock(&mp.threadLock)
+}
+
+// Called from exitm, but not from drop, to undo the effect of thread-owned
+// resources in minit, semacreate, or elsewhere. Do not take locks after calling this.
+//go:nosplit
+func mdestroy(mp *m) {
if mp.highResTimer != 0 {
stdcall1(_CloseHandle, mp.highResTimer)
mp.highResTimer = 0
}
- unlock(&mp.threadLock)
+ if mp.waitsema != 0 {
+ stdcall1(_CloseHandle, mp.waitsema)
+ mp.waitsema = 0
+ }
+ if mp.resumesema != 0 {
+ stdcall1(_CloseHandle, mp.resumesema)
+ mp.resumesema = 0
+ }
}
// Calling stdcall on os stack.
}
}
+ // Destroy all allocated resources. After this is called, we may no
+ // longer take any locks.
+ mdestroy(m)
+
if osStack {
// Return from mstart and let the system thread
// library free the g0 stack and terminate the thread.