> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XAsyncRun

> XAsyncRun

# XAsyncRun

지정된 콜백 함수를 비동기적으로 실행합니다.

## 구문

```cpp theme={null}
HRESULT XAsyncRun(  
         XAsyncBlock* asyncBlock,  
         XAsyncWork* work  
)  
```

### 매개 변수

*asyncBlock*   \_Inout\_\
형식: [XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

비동기 호출을 추적하는 데 사용되는 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)에 대한 포인터입니다.

*work*   \_In\_\
형식: [XAsyncWork\*](/reference/system/xasync/functions/xasyncwork)

비동기적으로 실행할 콜백 함수에 대한 포인터입니다.

### 반환 값

형식: [HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

성공하면 `S_OK`를 반환하고, 그렇지 않으면 오류 코드를 반환합니다. 오류 코드 목록은 [오류 코드](/reference/errorcodes)를 참조하세요.

## 설명

`XAsyncRun`은 *work*에 지정된 콜백 함수를 비동기적으로 실행하는 도우미 함수입니다. *asyncBlock*에 지정된 `XAsyncBlock`을 사용하여 콜백 함수를 취소하거나 상태를 가져올 수 있습니다. `XAsyncRun`은 내부적으로 다음 `XAsyncProvider` 함수를 사용하여 콜백 함수를 실행하고 추적합니다:

* [XAsyncBegin](/reference/system/xasyncprovider/functions/xasyncbegin)
* [XAsyncComplete](/reference/system/xasyncprovider/functions/xasynccomplete)
* [XAsyncSchedule](/reference/system/xasyncprovider/functions/xasyncschedule)

`XAsyncProvider` 및 `XAsyncBlock`을 사용하여 자체 비동기 기능을 구현하는 것에 대한 자세한 내용은 [비동기 프로그래밍 모델](/build/core-features/common/async/async-programming-model)을 참조하세요.

## 요구 사항

**헤더:** XAsync.h

**라이브러리:** xgameruntime.lib

**지원되는 플랫폼:** Windows, XBOX One 제품군 콘솔 및 XBOX Series 콘솔

## 개념 설명서

* [Microsoft Game Development Kit(GDK) API 작업 실행](/build/core-features/common/async/async-libraries/async-library-xasync-example-run-gdk-task)
* [간단한 작업 실행](/build/core-features/common/async/async-libraries/async-library-xasync-example-run-simple-task)
* [XAsync 라이브러리 개요](/build/core-features/common/async/async-libraries/async-library-xasync)
* [취소 가능성 설정](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability)
* [사용자 지정 공급자 설정](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-custom-provider)
* [비동기 프로그래밍 모델](/build/core-features/common/async/async-programming-model)
* [일반 비동기 작업 래퍼](/build/core-features/common/async/async-task-function-example)

## 함께 보기

[XAsync 멤버](/reference/system/xasync/xasync_members)\
[XAsyncProvider 멤버](/reference/system/xasyncprovider/xasyncprovider_members)\
[비동기 프로그래밍 모델](/build/core-features/common/async/async-programming-model)


## Related topics

- [XAsyncWork](/ko/reference/system/xasync/functions/xasyncwork.md)
- [XAsync](/ko/reference/system/xasync/xasync_members.md)
- [간단한 작업 실행 예제](/ko/build/core-features/common/async/async-libraries/async-library-xasync-example-run-simple-task.md)
- [XNetworkingQueryPreferredLocalUdpMultiplayerPortAsync](/ko/reference/networking/xnetworking/functions/xnetworkingquerypreferredlocaludpmultiplayerportasync.md)
- [일반 비동기 작업 래퍼](/ko/build/core-features/common/async/async-task-function-example.md)
