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

# hv_vcpu_destroy(_:)

Destroys the vCPU instance associated with the current thread.

## Declaration

```swift
func hv_vcpu_destroy(_ vcpu: hv_vcpu_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 important: This function must be called by the owning thread.

## See Also

### Creation and destruction

- [hv_vm_get_max_vcpu_count(_:)](hypervisor/hv_vm_get_max_vcpu_count(_:).md)
- [hv_vcpu_create(_:_:_:)](hypervisor/hv_vcpu_create(_:_:_:).md)
- [hv_vcpu_t](hypervisor/hv_vcpu_t.md)
