Multi-Treading and OCI
We do the following in a program :
1. The environment is properly initialized with OCI_THREADED (and without OCI_ENV_NO_MUTEX).
2. Two threads A and B are involved.
3. Thread A creates and properly sets up a service context handle and a session handle.
4. Both threads A and B use the same service context and session handles (though never concurrently). This works fine.
5. At one point, thread A ends. Thread B continues to execute.
6. After A ends, thread B gets an OCI_INVALID_HANDLE when it attempts to use the service context and session handles.
7. Note that thread B would have closed the handles before ending, but does not have the chance to get that far.