Establishes concurrency control for threaded client applications
Usage syntax
LONG SE_stable_set_concurrency (SE_STABLE stable, LONG policy);
Parameters
stable |
The s-table handle |
policy |
The concurrency policy |
Description
SE_stable_set_concurrency sets the concurrency policy for the specified
shape (s) table. The concurrency policy affects how calls to the API for this
shape table behave in a multithreaded environment.
The policies for concurrency are:
- SE_UNPROTECTED_POLICYNo concurrency control is provided. Calls by multiple threads on the same
s-table can cause unexpected errors.
- SE_ONE_THREAD_POLICYThe s-table is now owned by the calling thread, and any other thread
trying to use it immediately returns with an error code of SE_STABLE_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 s-table. If the owning thread terminates, then ownership is released
automatically.
- SE_TRYLOCK_POLICYWhenever an s-table connection is called, the entering thread tries to
lock. If it succeeds, it proceeds. If it fails, it immediately returns
with an error code of SE_STABLE_IN_USE.
- SE_LOCK_POLICYSimilar
to SE_TRYLOCK_POLICY, but instead of failing if the s-table is currently
in use, the call hangs until the thread that has the s-table currently
locked returns from its ArcSDE function call. If multiple threads are
waiting on the shape table, it is unknown which thread will get the lock
next.
The environment set by SE_stable_set_concurrency
applies to subsequent calls to SE_stable_set_concurrency. For safety in
a multithreaded environment, call SE_stable_set_concurrency on an s table
handle before passing it to any thread other than the one that created
it.
Returns
SE_SUCCESS
SE_CONNECTION_LOCKED
SE_FAILURE
SE_INVALID_PARAM_VALUE
SE_INVALID_POINTER
SE_OUT_OF_MUTEXES
SE_SDE_NOT_STARTED