---
title: "hv_vcpu_run_until(_:_:)"
framework: hypervisor
role: symbol
role_heading: Function
path: "hypervisor/hv_vcpu_run_until(_:_:)"
---

# hv_vcpu_run_until(_:_:)

Executes a vCPU until it reaches the deadline defined in absolute time units you provide.

## Declaration

```swift
func hv_vcpu_run_until(_ vcpu: hv_vcpuid_t, _ deadline: UInt64) -> hv_return_t
```

## Parameters

- `vcpu`: The instance of the vCPU.
- `deadline`: The timer deadline in mach absolute time units. Use the special value doc://com.apple.hypervisor/documentation/Hypervisor/HV_DEADLINE_FOREVER to specify a deadline that never expires.

## Return Value

Return Value HV_SUCCESS if the operation was successful, otherwise an error code specified in hv_return_t.

## Discussion

Discussion If the deadline you specify is other than HV_DEADLINE_FOREVER, this call uses the VMX preemption timer. If the hardware doesn’t support the VMX preemption timer, it returns HV_UNSUPPORTED. This function supersedes hv_vcpu_run(_:) on Intel-based Mac computers. Unlike hv_vcpu_run(_:), it doesn’t return on transparently handled VMEXITs.

## See Also

### Runtime

- [hv_vcpu_interrupt(_:_:)](hypervisor/hv_vcpu_interrupt(_:_:).md)
- [hv_vcpu_flush(_:)](hypervisor/hv_vcpu_flush(_:).md)
- [hv_vcpu_get_exec_time(_:_:)](hypervisor/hv_vcpu_get_exec_time(_:_:).md)
- [hv_vcpu_run(_:)](hypervisor/hv_vcpu_run(_:).md)
- [Execution Deadlines](hypervisor/3553338-execution-deadlines.md)
