Multi Thread Questions

Raoul

Member
Dear Marco and others,

A few questions and clarifications around threads and BreakExecution...

1) We have a thread, with its own session and package, both created in the main thread. Is it allowed to LogOn in the secondary thread ? With ThreadSafe = True ? False ?

2) Is it allowed to LogOff in the main thread after the thread has stopped ? When the thread is running and doing db access ? With ThreadSafe = True ? False ?

3) The thread is waiting on DbmsAlerts (with a timeout). Is it allowed to BreakExecution from the main thread ? Do we need ThreadSafe true if the only operation performed in the main thread is BreakExecution ? Will the BreakExecution hang ?

Thanks a lot, really...

--- Raoul
 
1) We have a thread, with its own session and package, both created in the main thread. Is it allowed to LogOn in the secondary thread ? With ThreadSafe = True ? False ?
It is allowed, with or without ThreadSafe = True. You only need to set ThreadSafe to True if multiple threads can access the same session or session related components at the same time.
2) Is it allowed to LogOff in the main thread after the thread has stopped ? With ThreadSafe = True ? False ?
Yes, with or without ThreadSafe. See 1.
When the thread is running and doing db access ?
You cannot logoff while the thread is running database access calls. The logoff will either fail (ThreadSafe = False) or wait (ThreadSafe = True).
3) The thread is waiting on DbmsAlerts (with a timeout). Is it allowed to BreakExecution from the main thread ? Do we need ThreadSafe true if the only operation performed in the main thread is BreakExecution ? Will the BreakExecution hang ?
This is allowed, and BreakExecution will not hang, but the Server may not respond to the break signal. It is best to send an alert that will signal the thread to stop.
 
Thanks for your quick response, Marco

Unfortunatly, we were (successfully) using BreakExecution to work around dbms_alert.wait hanging with 8.1.7 client
when the connection to db is lost (BUG# 2574614)

But now, we face issues with BreakExecution on Oracle 9 IPC connections :-)

I guess I will trash the whole idea and kill brutally the dbms_alert listening thread when connection is lost. If you have any better idea, it would be most welcome (migrating all the installed base to a newer oracle client is not really easy)
 
Back
Top