MCPcopy
hub / github.com/opencontainers/runc / Pause

Method Pause

libcontainer/container_linux.go:761–778  ·  view source on GitHub ↗

Pause pauses the container, if its state is RUNNING or CREATED, changing its state to PAUSED. If the state is already PAUSED, does nothing.

()

Source from the content-addressed store, hash-verified

759// Pause pauses the container, if its state is RUNNING or CREATED, changing
760// its state to PAUSED. If the state is already PAUSED, does nothing.
761func (c *Container) Pause() error {
762 c.m.Lock()
763 defer c.m.Unlock()
764 status, err := c.currentStatus()
765 if err != nil {
766 return err
767 }
768 switch status {
769 case Running, Created:
770 if err := c.cgroupManager.Freeze(cgroups.Frozen); err != nil {
771 return err
772 }
773 return c.state.transition(&pausedState{
774 c: c,
775 })
776 }
777 return ErrNotRunning
778}
779
780// Resume resumes the execution of any user processes in the
781// container before setting the container state to RUNNING.

Callers 3

pause.goFile · 0.80
Example_containerFunction · 0.80
testFreezeFunction · 0.80

Calls 3

currentStatusMethod · 0.95
FreezeMethod · 0.80
transitionMethod · 0.65

Tested by 2

Example_containerFunction · 0.64
testFreezeFunction · 0.64