vm

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package vm provides the core runtime helpers for Apple Virtualization VMs.

It is the smallest useful set of abstractions for working with a running VM: queue management, VM creation and lifecycle, state queries, validation, and Objective-C retain helpers.

Higher-level packages in x/vzkit build on this package so callers can start with a narrow surface and opt into advanced runtime features only when needed.

Package vm provides queue management and lifecycle operations for virtual machines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanPause

func CanPause(queue *Queue, machine vz.VZVirtualMachine) bool

CanPause reports whether the VM is in a state that allows pausing.

func CanResume

func CanResume(queue *Queue, machine vz.VZVirtualMachine) bool

CanResume reports whether the VM is in a state that allows resuming.

func CanStart

func CanStart(queue *Queue, machine vz.VZVirtualMachine) bool

CanStart reports whether the VM is in a state that allows starting.

func CanStop

func CanStop(queue *Queue, machine vz.VZVirtualMachine) bool

CanStop reports whether the VM is in a state that allows stopping.

func Create

Create creates a VZVirtualMachine bound to the given dispatch queue.

func Pause

func Pause(queue *Queue, machine vz.VZVirtualMachine, completion func(error))

Pause pauses a running VZVirtualMachine on its queue.

func Resume

func Resume(queue *Queue, machine vz.VZVirtualMachine, completion func(error))

Resume resumes a paused VZVirtualMachine on its queue.

func RunLoopAggressively

func RunLoopAggressively()

RunLoopAggressively pumps both CFRunLoop and NSRunLoop multiple times.

func RunLoopOnce

func RunLoopOnce()

RunLoopOnce runs the main CFRunLoop briefly to process pending callbacks.

func RunLoopUntilDone

func RunLoopUntilDone(done func() bool, progress func())

RunLoopUntilDone runs the main run loop until done returns true.

func Start

func Start(queue *Queue, machine vz.VZVirtualMachine, completion func(error))

Start starts a VZVirtualMachine on its queue and calls completion with the result.

func State

func State(queue *Queue, machine vz.VZVirtualMachine) vz.VZVirtualMachineState

State returns the current state of a VZVirtualMachine, dispatching to queue.

func Stop

func Stop(queue *Queue, machine vz.VZVirtualMachine, completion func(error))

Stop requests a stop of a VZVirtualMachine on its queue.

func Validate

func Validate(config vz.VZVirtualMachineConfiguration) error

Validate validates a VZVirtualMachineConfiguration and returns any error.

Types

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

Queue wraps a dispatch queue for VM operations. The Virtualization framework requires VM operations to happen on a specific queue.

func NewQueue

func NewQueue(label string) *Queue

NewQueue creates a serial dispatch queue with the given label.

func WrapQueue

func WrapQueue(q dispatch.Queue) *Queue

WrapQueue creates a Queue from an existing dispatch.Queue.

func (*Queue) Async

func (q *Queue) Async(work func())

Async executes work asynchronously on the dispatch queue.

func (*Queue) Queue

func (q *Queue) Queue() dispatch.Queue

Queue returns the underlying dispatch.Queue.

func (*Queue) Sync

func (q *Queue) Sync(work func())

Sync executes work synchronously on the dispatch queue.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL