The resource_alloc instruction allocates or frees licensed system resources.
Synopsis
#include < irDefines.h >
resource_alloc(type.flag, type.capability, type.implementation
[, type.returnMode ])
Description
Note:
The instruction resource_alloc replaces sp_alloc. Continued use of sp_alloc is discouraged.
The resource_alloc instruction explicitly allocates capability type.capability of implementation type.implementation to the channel upon which the script is executed. This allows applications to proceed forth without concern for resource availability at the expense of inefficient resource utilization (applications may hold resources that they are not using).
The argument type.flag if true, indicates to allocate resources, otherwise free resources. The argument type.capability indicates the capability to allocate as defined in irResource.h, for example IRC_RECOG, IRC_TTS, etc. The argument type.implementation indicates the implementation, as defined in irDefines.h, corresponding to the capability argument. For example, an implementation of IRC_RECOG is IRD_WHOLE_WORD. The argument type.returnMode indicates the optional return mode on resource allocation. It may be one of IRD_IMMEDIATE, IRD_BLOCKFOREVER or some integer N indicating return with immediate failure if resources are not available, block forever (indefinitely) until resources become available, or wait at most N hundsecs for resources respectively. Defines are in irDefines.h. The default is the current value of the TSM parameter RESOURCE_RETURNMODE. RESOURCE_RETURNMODE is set through setparam. By default TSM sets RESOURCE_RETURNMODE to 10 seconds.
Return values
The return value placed in r.0 as follows:
0 |
The resource is successfully allocated. |
-1 |
A system error occurs. |
-2 |
No resources are in service. |
-3 |
No resources are currently available. |