mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add the context.PrepareSleep platform callback.
It is called only when a task switches to the interruptible sleep, because it is the only state where the task can sleep for a long time. PiperOrigin-RevId: 485963460
This commit is contained in:
@@ -189,6 +189,7 @@ func (t *Task) block(C <-chan struct{}, timerChan <-chan struct{}) error {
|
||||
// prepareSleep prepares to sleep.
|
||||
func (t *Task) prepareSleep() {
|
||||
t.assertTaskGoroutine()
|
||||
t.p.PrepareSleep()
|
||||
t.Deactivate()
|
||||
t.accountTaskGoroutineEnter(TaskGoroutineBlockedInterruptible)
|
||||
}
|
||||
|
||||
@@ -126,3 +126,6 @@ func (c *context) FullStateChanged() {}
|
||||
|
||||
// PullFullState implements platform.Context.PullFullState.
|
||||
func (c *context) PullFullState(as platform.AddressSpace, ac *arch.Context64) {}
|
||||
|
||||
// PrepareSleep implements platform.Context.platform.Context.
|
||||
func (*context) PrepareSleep() {}
|
||||
|
||||
@@ -244,6 +244,10 @@ type Context interface {
|
||||
|
||||
// Release() releases any resources associated with this context.
|
||||
Release()
|
||||
|
||||
// PrepareSleep() is called when the tread switches to the
|
||||
// interruptible sleep state.
|
||||
PrepareSleep()
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@@ -199,6 +199,9 @@ func (c *context) FullStateChanged() {}
|
||||
// PullFullState implements platform.Context.PullFullState.
|
||||
func (c *context) PullFullState(as platform.AddressSpace, ac *arch.Context64) {}
|
||||
|
||||
// PrepareSleep implements platform.Context.platform.PrepareSleep.
|
||||
func (*context) PrepareSleep() {}
|
||||
|
||||
// PTrace represents a collection of ptrace subprocesses.
|
||||
type PTrace struct {
|
||||
platform.MMapMinAddr
|
||||
|
||||
Reference in New Issue
Block a user