Threadsafe Introduction

 

The SwitchKit Threadsafe library is an optional replacement for the standard library provided with the SwitchKit development package. It contains the standard SK API for non multi-threaded applications as well as threadsafe versions of each C function and C++ method as necessary. These new functions and methods are the only functions and methods that should be used by the application developer wishing to use the SwitchKit threadsafe library.

Important! The SwitchKit Threadsafe library for Linux is a shared not a static library.

Notational Conventions

All new functions in the threadsafe library begin with the skts_ prefix instead of the customary sk_ of the standard SwitchKit library. There is one additional method in the SKC_Message class, tsSend(), that all message classes inherit from, which allows messages to be sent safely in a multi-threaded environment. Failure to use the appropriate functions once thread safety has been enabled will result in the following error being logged in the application’s maintenance log:

Where someFunctionName() is the actual function that was improperly called:

"Function call made to unsafe API(someFunctionName()) when Thread Safety enabled."

Applications should not mix threadsafe function calls with non-threadsafe SwitchKit function calls. Failure to heed this warning will cause unexpected and potentially hazardous results.