strpattern_context_set_sync()

Specify synchronous or asynchronous execution of pattern matching.

Synopsis:

#include </strpattern.h>
 
void strpattern_context_set_sync(strpattern_context *context, int type, int *err)

Arguments:

context

The context object where the type of execution is set.

type

The type of execution (STRPATTERN_CONTEXT_EXEC_AUTO, *_SYNC, and *_ASYNC).

err

STRPATTERN_EOK if there is no error.

Library:

libstrpattern

Description:

Setting the type of execution to STRPATTERN_CONTEXT_EXEC_AUTO and passing the context object when calling strpattern_analyze() enables the automatic selection of whether the pattern-matching procedures are executed synchronously or asynchronously.

Setting the type of execution to STRPATTERN_CONTEXT_EXEC_SYNC and passing the context object when calling strpattern_analyze() results in the synchronous execution of the pattern-matching procedures. The callback which receives the results is called before strpattern_analyze() returns on the thread where strpattern_analyze() was called.

Setting the type of execution to STRPATTERN_CONTEXT_EXEC_ASYNC and passing the context object when calling strpattern_analyze() results in the asynchronous execution of the pattern-matching procedures. The function strpattern_analyze() only schedules the pattern matching request and returns. The callback which receives the results is called on a library thread different from the thread where strpattern_analyze() was called.

By default, a context object specifies STRPATTERN_CONTEXT_EXEC_AUTO.

Returns: