CallSerializer::Wrap (open)

Wrap a function pointer, returns a proxy that will ensure the function will be called in a serialized manner.

Syntax

LOADLIB "wh::async.whlib";

FUNCTION PTR FUNCTION Wrap(FUNCTION PTR func, RECORD options)

Parameters

FUNCTION PTR func

Function to wrap

RECORD options

Options

coalescetag

If not empty, coalesce multiple pending calls to one call (if a call is running, a new call is still scheduled). If not empty, the returned function does not take any parameters (unless ignoreparameters is set)

ignoreparameters

If set, ignore parameters passed to the returned function, and call the passed function without any parameters.

Return value

FUNCTION PTR

A function pointer that when called will first wait for a execution slot to become available, will call the wrapped function ptr, and return its result.