On 29/03/2019 12:05, Joe Watkins wrote:
No, it's broken in both modes.
In NTS mode, both the thread that handles events (which illegally calls
user code) and the main thread are executing concurrently, they may both
be calling functions that cause interaction with module globals, which
are obviously shared between threads in NTS mode.
You cannot just start threads and execute user code from anywhere, it's
not safe in NTS mode and is a horrible violation of share nothing in ZTS
mode. It's much more likely to break ZTS mode than NTS, but illegal in both.
The main problem here is that Firebird events are not something one is
likely to use when running a web service? Which is why simply disabling
the events functions would be my own fix in the absence of anybody
coming forward to say they ARE using them. Asynchronous access to third
party services is an area that does require a much more cooperative code
base? Simply asking for a query to run, going off to do other activity,
and returning when the result is available is the sort of activity we
are talking about here?
From the Firebird docs ...
The event notification is asynchronous and takes place at the end of the
transaction in which the event was generated. A separate thread is created by
TIBEvents to wait on the event notification. When the event occurs it calls the
“OnEventAlert” event handler to report which event has been received. Note that
the event handler is run in the context of the main thread and hence there is
no need to worry about thread synchronisation.
So ibase_wait_event is sitting listening on the same connection that set
the event handler and shares that connection which is where the current
method of working comes from. But I have no idea if this can be changed.
It is the firebird client which is actually holding the connection on
which ibase_wait_event is listening. Using it depends very much on how
PHP handles asynchronous events while I simply want to know that the
read or write I've just done was successful or not ...
--
Lester Caine - G8HFL
-----------------------------
Contact - https://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - https://lsces.co.uk
EnquirySolve - https://enquirysolve.com/
Model Engineers Digital Workshop - https://medw.co.uk
Rainbow Digital Media - https://rainbowdigitalmedia.co.uk
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php