Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions phpmainthread.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ func initPHPThreads(numThreads int) error {
}
phpThreads = make([]*phpThread, numThreads)

if err := mainThread.start(); err != nil {
return err
}

// initialize all threads as inactive
// this needs to happen before starting the main thread
// since some extensions access environment variables on startup
for i := 0; i < numThreads; i++ {
phpThreads[i] = newPHPThread(i)
convertToInactiveThread(phpThreads[i])
}

if err := mainThread.start(); err != nil {
return err
}

// start the underlying C threads
ready := sync.WaitGroup{}
ready.Add(numThreads)
Expand Down
5 changes: 2 additions & 3 deletions phpthread.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,10 @@ func (thread *phpThread) getActiveRequest() *http.Request {
// Pin a string that is not null-terminated
// PHP's zend_string may contain null-bytes
func (thread *phpThread) pinString(s string) *C.char {
if s == "" {
sData := unsafe.StringData(s)
if sData == nil {
return nil
}

sData := unsafe.StringData(s)
thread.Pin(sData)

return (*C.char)(unsafe.Pointer(sData))
Expand Down
Loading