Developing Apama Applications > Developing Clients > The Client Software Development Kits for C++ and Java > The library classes > Thread-safety
Thread-safety
The C++ SDK is thread-safe, in the sense that you can call API methods from any thread. In particular you can:
*Call connectToEngine() and disconnectFromEngine() from different threads
*Attach and detach event consumers on different threads
Background threads are created when you call engineInit() and destroyed when engineShutdown() is called. Events received from a correlator will be handled in one of these background threads, so you cannot assume that events will be delivered to you on any particular thread. In the C++ SDK, you must call engineShutdown() before calling exit() or returning from the main function; not doing so may result in a crash.
Note that the API functions are not synchronized, so if you have data that you need to protect from concurrent access, you will need to implement synchronization yourself.
The same applies for the SDK for Java.
Copyright © Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its Subsidiaries and or/its Affiliates and/or their licensors.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.