mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: convert sigqueue to Go
LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews, khr https://golang.org/cl/132090043
This commit is contained in:
parent
98bebcc90a
commit
651d0cf204
3 changed files with 85 additions and 24 deletions
42
src/pkg/runtime/sigqueue.go
Normal file
42
src/pkg/runtime/sigqueue.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright 2009 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.
|
||||
|
||||
// This file implements runtime support for signal handling.
|
||||
|
||||
package runtime
|
||||
|
||||
func signal_recv() (m uint32) {
|
||||
for {
|
||||
mp := acquirem()
|
||||
onM(&signal_recv_m)
|
||||
ok := mp.scalararg[0] != 0
|
||||
m = uint32(mp.scalararg[1])
|
||||
releasem(mp)
|
||||
if ok {
|
||||
return
|
||||
}
|
||||
gonotetsleepg(&signote, -1)
|
||||
gonoteclear(&signote)
|
||||
}
|
||||
}
|
||||
|
||||
func signal_enable(s uint32) {
|
||||
mp := acquirem()
|
||||
mp.scalararg[0] = uint(s)
|
||||
onM(&signal_enable_m)
|
||||
releasem(mp)
|
||||
}
|
||||
|
||||
func signal_disable(s uint32) {
|
||||
mp := acquirem()
|
||||
mp.scalararg[0] = uint(s)
|
||||
onM(&signal_disable_m)
|
||||
releasem(mp)
|
||||
}
|
||||
|
||||
var (
|
||||
signal_recv_m,
|
||||
signal_enable_m,
|
||||
signal_disable_m mFunction
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue