Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Q:Thread safe Oracle client library

12 views
Skip to first unread message

qi...@plx.com

unread,
Mar 4, 1999, 3:00:00 AM3/4/99
to
I have read the "developing multi-threaded Application" section of
<<Pro*C/C++ precompiler Programmer's Guide>> I got a question for "Multiple
Threads Sharing a Single Runtime Context" The document says you cannot share
a runtime context between multiple threads at the same time if two or more
threads attempt to use the same runtime context simultaneously, it will give
the runtime error: SQL-02131: Runtime context in use. I am not sure if that
is comform to "Thread safe", suppose client should wait to gain access the
connection instead of give a runtime error..is oracle internally use mutex
or semaphore? If they do, why they have such a limitation?


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

Thomas Kyte

unread,
Mar 4, 1999, 3:00:00 AM3/4/99
to
A copy of this was sent to qi...@plx.com
(if that email address didn't require changing)

On Thu, 04 Mar 1999 01:28:39 GMT, you wrote:

>I have read the "developing multi-threaded Application" section of
><<Pro*C/C++ precompiler Programmer's Guide>> I got a question for "Multiple
>Threads Sharing a Single Runtime Context" The document says you cannot share
>a runtime context between multiple threads at the same time if two or more
>threads attempt to use the same runtime context simultaneously, it will give
>the runtime error: SQL-02131: Runtime context in use. I am not sure if that
>is comform to "Thread safe", suppose client should wait to gain access the
>connection instead of give a runtime error..is oracle internally use mutex
>or semaphore? If they do, why they have such a limitation?
>
>

the libs are thread safe in that:

- if each thread has its own context (connection) they can all simultaneously
work on the database -- each in their own session. the sqllib calls are thread
safe and reentrant.

- if threads SHARE a context (connection) it is up to you the programmer to
ensure that one one thread at a time uses THAT context -- else an error is
raised.


the API is thread safe, a connection can only be used by one thread at a time,
each thread can work independently of every other thread if it has its own
connection.

>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own


Thomas Kyte
tk...@us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities

----------------------------------------------------------------------------
Opinions are mine and do not necessarily reflect those of Oracle Corporation

0 new messages