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

Method boot

phpthread.go:61–79  ·  view source on GitHub ↗

boot starts the underlying PHP thread

()

Source from the content-addressed store, hash-verified

59
60// boot starts the underlying PHP thread
61func (thread *phpThread) boot() {
62 // thread must be in reserved state to boot
63 if !thread.state.CompareAndSwap(state.Reserved, state.Booting) && !thread.state.CompareAndSwap(state.BootRequested, state.Booting) {
64 panic("thread is not in reserved state: " + thread.state.Name())
65 }
66
67 // boot threads as inactive
68 thread.handlerMu.Lock()
69 thread.handler = &inactiveThread{thread: thread}
70 thread.drainChan = make(chan struct{})
71 thread.handlerMu.Unlock()
72
73 // start the actual posix thread - TODO: try this with go threads instead
74 if !C.frankenphp_new_php_thread(C.uintptr_t(thread.threadIndex)) {
75 panic("unable to create thread")
76 }
77
78 thread.state.WaitFor(state.Inactive)
79}
80
81// reboot exits the C thread loop for full ZTS cleanup, then spawns a fresh C thread.
82// Returns false if the thread is no longer in Ready state (e.g. shutting down).

Callers 2

getInactivePHPThreadFunction · 0.80
allPossibleTransitionsFunction · 0.80

Calls 3

CompareAndSwapMethod · 0.80
NameMethod · 0.80
WaitForMethod · 0.80

Tested by 1

allPossibleTransitionsFunction · 0.64