MCPcopy Index your code
hub / github.com/php/frankenphp / setHandler

Method setHandler

phpthread.go:140–155  ·  view source on GitHub ↗

setHandler changes the thread handler safely must be called from outside the PHP thread

(handler threadHandler)

Source from the content-addressed store, hash-verified

138// setHandler changes the thread handler safely
139// must be called from outside the PHP thread
140func (thread *phpThread) setHandler(handler threadHandler) {
141 thread.handlerMu.Lock()
142 defer thread.handlerMu.Unlock()
143
144 if !thread.state.RequestSafeStateChange(state.TransitionRequested) {
145 // no state change allowed == shutdown or done
146 return
147 }
148
149 close(thread.drainChan)
150
151 thread.state.WaitFor(state.TransitionInProgress)
152 thread.handler = handler
153 thread.drainChan = make(chan struct{})
154 thread.state.Set(state.TransitionComplete)
155}
156
157// transition to a new handler safely
158// is triggered by setHandler and executed on the PHP thread

Callers 4

convertToTaskThreadFunction · 0.80
convertToWorkerThreadFunction · 0.80
convertToInactiveThreadFunction · 0.80
convertToRegularThreadFunction · 0.80

Calls 3

WaitForMethod · 0.80
SetMethod · 0.80

Tested by 1

convertToTaskThreadFunction · 0.64