> ## 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](/reference/system/xasync/functions/xasyncrun) 함수로 시작할 수 있습니다. 이 함수는 async 블록을 입력으로 받으며, 작업 콜백을 펑터(functor) 또는 람다 입력으로 구현해야 합니다. async 블록은 사용할 작업 큐와 선택적인 완료 콜백을 지정한다는 점을 기억하세요.

```c++ theme={null}
XAsyncBlock* async = new XAsyncBlock{};
async->queue = taskQueue;
async->context = contextData;
async->callback = 
    [](XAsyncBlock* async)
    {
        // The optional completion callback.
        delete async;
    }

XAsyncRun(async,
    [](XAsyncBlock* async)->HRESULT
    {
        // The work callback is implemented here.
        return S_OK;
    });
```

이 예에서는 `XAsyncRun`을 사용하여 사용자 지정한 간단한 비동기 작업을 시작합니다. async 블록에는 사용할 작업 큐와 완료 콜백이 포함되어 있습니다. `XAsyncRun`에는 작업 콜백이 필요하며, 반환 값이 있습니다. 이 반환 값은 이후 [XAsyncGetStatus](/reference/system/xasync/functions/xasyncgetstatus) 호출에서 반환됩니다. 내부적으로 `XAsyncRun`에는 지정된 작업 콜백의 큐잉, async 블록의 완료 콜백 큐잉 및 이 프로세스의 기타 상태 변경을 처리하기 위한 간단한 async 공급자 설정이 있습니다. 즉, 간단한 비동기 작업을 실행하는 데 추가 코드가 필요하지 않으며, async 블록을 설정하고 `XAsyncRun`을 호출하기만 하면 됩니다.

## 참고 API 문서

* [XAsync(API 콘텐츠)](/reference/system/xasync/xasync_members)
  * 함수
    * [XAsyncRun](/reference/system/xasync/functions/xasyncrun)
    * [XAsyncGetStatus](/reference/system/xasync/functions/xasyncgetstatus)

## 참고 항목

[XAsync 라이브러리 개요](/build/core-features/common/async/async-libraries/async-library-xasync)

[비동기 작업 설정(예제)](/build/core-features/common/async/async-libraries/async-library-xasync-example-setup-async-task)

[Microsoft Game Development Kit(GDK) API 작업 실행(예제)](/build/core-features/common/async/async-libraries/async-library-xasync-example-run-gdk-task)

[XAsync](/reference/system/xasync/xasync_members)


## Related topics

- [Microsoft Game Development Kit API 작업 실행 예제](/ko/build/core-features/common/async/async-libraries/async-library-xasync-example-run-gdk-task.md)
- [비동기 작업 설정 예제](/ko/build/core-features/common/async/async-libraries/async-library-xasync-example-setup-async-task.md)
- [비동기 작업 프로그래밍을 위한 XAsync 라이브러리](/ko/build/core-features/common/async/async-libraries/index.md)
- [XAsync 라이브러리 개요](/ko/build/core-features/common/async/async-libraries/async-library-xasync.md)
- [XAsyncRun](/ko/reference/system/xasync/functions/xasyncrun.md)
