Cleans-up orphaned semaphore files from a directory, which can improve the performance of SK_PLUS_NetworkSemaphoreOpen (especially when all or nearly all network seats are in use). Calling this function is also necessary when using the SK_FLAGS_NETWORK_SEMAPHORE_SKIPLOCKATTEMPT flag with SK_PLUS_NetworkSemaphoreOpen.
The semaphorePath and semaphorePrefix parameters are required unless you have a semaphore open from a prior, successful call to SK_PLUS_NetworkSemaphoreOpen. If you provide a null or empty string after opening a semaphore, this function will automatically use the same semaphore path and prefix used to open the semaphore.
By default, this function creates a thread so the application can attempt to delete any orphaned semaphore files without experiencing any visible delay in the protected application. When using this functionality, it is important for you to test thoroughly to ensure your application is not adversely affected by the thread that is created. (For example, there are some cases where creating threads can be problematic, such as when certain or custom threading models are used. There are other cases with limitations to consider with threading, such as during DLL initialization.) The thread created by this function is automatically terminated when: this function is called again, the SK_PLUS_NetworkSemaphoreDispose function is called, or the SK_ApiContextDispose function is called.
Having your application periodically attempt to delete all orphaned semaphore files can cause network congestion (especially with larger-scale deployments), and this needs to be considered before deploying your applications to production environments. For this reason, this function enforces a minimum of 600 seconds (10 minutes) in the delay parameter (when not specifying zero).
If you have concerns about threading or network congestion, you should consider the following options for your application:
All possible return values are included in the SK_ResultCode enumeration. Return codes to expect include:
Result Code | Description |
---|---|
SK_ResultCode.SK_ERROR_NONE | No error. |
SK_ResultCode.SK_ERROR_INVALID_ARGUMENTS | Some or all of the arguments are invalid. |
SK_ResultCode.SK_ERROR_NETWORK_SEMAPHORE_INVALID_PATH | The network path is not valid or is unavailable. |
SK_ResultCode.SK_ERROR_UNSUPPORTED_OS | The current operating system is not supported by this feature or function. |
SK_ResultCode.SK_ERROR_MEMORY_ALLOCATION | Memory could not be allocated. |