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

# hv_vcpu_flush(_:)

Flushes the cached state of a vCPU.

## Declaration

```swift
func hv_vcpu_flush(_ vcpu: hv_vcpuid_t) -> hv_return_t
```

## Parameters

- `vcpu`: The instance of the vCPU.

## Return Value

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

## Discussion

Discussion This function must be called by the owning thread.

## See Also

### Runtime

- [hv_vcpu_run_until(_:_:)](hypervisor/hv_vcpu_run_until(_:_:).md)
- [hv_vcpu_interrupt(_:_:)](hypervisor/hv_vcpu_interrupt(_:_:).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)
