非同步屬性

[async] ACF 屬性會將遠端程序呼叫定義為非同步作業。

[async, opt-acf-attributes] function-name (param-list)

參數

opt-acf-attributes

指定選擇性的應用程式組態屬性。

function-name

指定 IDL 檔案中的函式名稱。

param-list

指定選擇性參數清單。

備註

此屬性不適用於 COM 介面。

若要將 RPC 函式宣告為非同步,請先將函式宣告為 IDL 檔案中介面定義的一部分。 然後套用 [async] 屬性,在應用程式組態檔內修改該函式宣告, (ACF) 。 請注意,函式宣告不會提及非同步控制碼,而且系結控制碼是第一個參數。 在 ACF 檔案中套用 [async] 屬性會產生適當的程式碼,以便在呼叫此函式時,非同步伺服器預期會在其他參數之前收到非同步控制碼。

注意

非同步屬性不能與 /osf 命令列參數搭配使用。

 

範例

//file:Xasync.idl
interface AsyncIface 
{
    HRESULT MyAsyncFunc (
        handle_t hBinding,
        [in] int a,
        [in] int b,
        [out] int *c) ;
//other interface definitions
}
//end XAsync.idl

// file: Xasync.acf
interface AsyncIface
{
    [async] MyAsyncFunc () ;
    //any other ACF definitions
}
//end Xasync.acf

另請參閱

應用程式組態檔 (ACF)

非同步 RPC