SE_connection_set_concurrency |
Establishes concurrency control for threaded client applications
LONG SE_connection_set_concurrency (SE_CONNECTION connection, LONG policy);
connection | The connection handle |
policy | The concurrency policy |
SE_connection_set_concurrency sets the concurrency policy for the specified connection. The concurrency policy affects how calls to the API for this connection behave in a multithreaded environment.
The policies for concurrency are as follows:
SE_UNPROTECTED_POLICYNo protection; there is no overhead, but calls by multiple threads to the same handle may result in major problems.
SE_ONE_THREAD_POLICYThe handle is now owned by the calling thread, and any other thread trying to use it immediately returns with an error code of SE_CONNECTION_LOCKED. The owning thread must yield ownership by calling this function with an argument other than SE_ONE_THREAD_POLICY before any other thread can use this handle. If the owning thread terminates, it automatically releases its ownership.
SE_TRYLOCK_POLICYWhenever an ArcSDE function with a connection or stream argument is entered, the entering thread tries to lock. If it succeeds, it proceeds; if it fails, it immediately returns with an error code of SE_CONNECTION_IN_USE.
SE_LOCK_POLICYSimilar to SE_TRYLOCK_POLICY, but instead of failing if the connection is currently in use, the call hangs until the thread that has the connection currently locked returns from its ArcSDE function call. If multiple threads are waiting on the connection, it is impossible to predict which thread will get the lock next.
SE_SUCCESS
SE_FAILURE
SE_CONNECTION_LOCKED
SE_INVALID_PARAM_VALUE
SE_INVALID_POINTER
SE_OUT_OF_MUTEXES
SE_SDE_NOT_STARTED
∙ The environment set by SE_connection_set_concurrency applies to subsequent calls to this function. For safety in a multithread environment, call SE_connection_set_concurrency on a connection before it is passed to any thread other than the one that opened the connection.