TOracleEvent.Stop does not wait...

DavidH

Member²
if OEvent.Started then OEvent.Stop;
OEvent.ObjectNames := S;
OEvent.Start;

This code gives me an "Operation not allowed on a started TOracleEvent" exception.

There is a workaround though:

if OEvent.Started then OEvent.Stop;
while OEvent.Started do Sleep(20);
OEvent.ObjectNames := S;
OEvent.Start;

Is this the right way to do it?

// David
 
What Direct Oracle Access version are you using?

------------------
Marco Kalter
Allround Automations
 
You could upgrade to 3.4.3, but I don't think that will help. It certainly won't harm either.

It seems to me that this situation is only possible if some exception has ocurred during the stop procedure, that was handled improperly. Could you run this program with the Oracle Monitor and check what happens when the event is stopped?

------------------
Marco Kalter
Allround Automations
 
Okay, I downloaded Oracle Monitor and ran the app some more, both with and without the workaround ("while Event.started do sleep(20)").

I could not find anything strange in Oracle Monitor, it does not show something about that actually an exception occurred without the workaround (Operation not allowed on a started TOracleEvent).

I did not know what or where to search either...
 
I was quite curious so I investigated the problem a bit more!

I think our problem might be that TEventThread.Alertloop calls Criticalsection.Leave right before (instead of right after, which would solve the problem) it sets the Started property to false.
 
It is amazing that thread execution leads to this error, but you are right. The Started property should be set to False within the critical section, both in the PipeLoop and the AlertLoop. We will fix this.

------------------
Marco Kalter
Allround Automations
 
Back
Top