-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue.go
More file actions
27 lines (23 loc) · 686 Bytes
/
Copy pathqueue.go
File metadata and controls
27 lines (23 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package queue
// #include <Zend/zend_types.h>
// #include "queue.h"
import "C"
import (
"unsafe"
"github.com/dunglas/frankenphp"
"go.uber.org/zap"
)
//export_php:function frankenphp_queue(mixed $data): void
func queue(data *C.zval) {
var p C.zval
C.zval_copy_value(&p, data)
w.InjectRequest(&frankenphp.WorkerRequest{
CallbackParameters: unsafe.Pointer(&p),
// Less efficient, but simpler alternative (do more operations)
//CallbackParameters: frankenphp.GoValue(unsafe.Pointer(data)),
AfterFunc: func(callbackReturn any) {
C.zval_ptr_dtor(&p)
w.logger.Debug("frankenphp_queue() finished", zap.Any("parameters", p), zap.Any("return", callbackReturn))
},
})
}