|
@@ -1374,22 +1374,22 @@ UA_Server_AccessControl_allowHistoryUpdateDeleteRawModified(UA_Server *server,
|
|
|
#endif // UA_ENABLE_HISTORIZING
|
|
|
|
|
|
/**
|
|
|
-* .. _async_methods:
|
|
|
+* .. _async_operations:
|
|
|
*
|
|
|
-* Async Methods
|
|
|
-* -------------
|
|
|
-* Sample on working with async method calls
|
|
|
-* Check client_method_async and tutorial_server_method_async for working samples.
|
|
|
+* Async Operations
|
|
|
+* ----------------
|
|
|
+* Some operations (such as reading out a sensor that needs to warm up) can take
|
|
|
+* quite some time. In order not to block the server during such an operation, it
|
|
|
+* can be "outsourced" to a worker thread.
|
|
|
*
|
|
|
-* Minimal Server:
|
|
|
+* Take the example of a CallRequest. It is split into the individual method call
|
|
|
+* operations. If the method is marked as async, then the operation is put into a
|
|
|
+* queue where it is be retrieved by a worker. The worker returns the result when
|
|
|
+* ready. See the examples in ``/examples/tutorial_server_method_async.c`` for
|
|
|
+* the usage.
|
|
|
*
|
|
|
-* - Create a method node
|
|
|
-* - mark as async: ``UA_Server_MethodNodeAsync``
|
|
|
-* - set callback to be notified: ``config->asyncOperationNotifyCallback = ...``
|
|
|
-* - fetch MethodCall: ``UA_Server_GetNextAsyncMethod``
|
|
|
-* - execute Method: e.g. UA_Server_call(UA_Server*, UA_CallMethodRequest*)
|
|
|
-* - pass back the result: ``UA_Server_SetAsyncMethodResult``
|
|
|
-* - free memory used: free UA_CallMethodResult */
|
|
|
+* Note that the operation can time out (see the asyncOperationTimeout setting in
|
|
|
+* the server config) also when it has been retrieved by the worker. */
|
|
|
|
|
|
#if UA_MULTITHREADING >= 100
|
|
|
|
|
@@ -1417,20 +1417,19 @@ typedef union {
|
|
|
/* UA_StatusCode writeResult; */
|
|
|
} UA_AsyncOperationResponse;
|
|
|
|
|
|
-/* Get and remove next Method Call Request
|
|
|
+/* Get the next async operation
|
|
|
*
|
|
|
* @param server The server object
|
|
|
* @param type The type of the async operation
|
|
|
* @param request Receives pointer to the operation
|
|
|
* @param context Receives the pointer to the operation context
|
|
|
- * @return UA_FALSE if queue is empty, UA_TRUE else
|
|
|
- * Note: Timeout is doubled for requests which already got fetched by worker via UA_Server_getAsyncOperation */
|
|
|
+ * @return false if queue is empty, true else */
|
|
|
UA_Boolean UA_EXPORT
|
|
|
UA_Server_getAsyncOperation(UA_Server *server, UA_AsyncOperationType *type,
|
|
|
const UA_AsyncOperationRequest **request,
|
|
|
void **context);
|
|
|
|
|
|
-/* Worker submits Method Call Response
|
|
|
+/* Submit the next async operation
|
|
|
*
|
|
|
* @param server The server object
|
|
|
* @param response Pointer to the operation result
|