Developing Apama Applications > Developing Clients > The C++ and Java Client Software Development Kits > 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 Java SDK.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.