예제 #1
0
파일: engine.go 프로젝트: zhoupingl/go-php
// Destroy shuts down and frees any resources related to the PHP engine bindings.
func (e *Engine) Destroy() {
	for _, c := range e.contexts {
		c.Destroy()
	}

	e.contexts = nil

	if e.engine != nil {
		C.engine_shutdown(e.engine)
		e.engine = nil
	}
}
예제 #2
0
파일: engine.go 프로젝트: deuill/sigil
func init() {
	ptr, err := C.engine_init()
	if err != nil {
		panic("PHP engine failed to initialize")
	}

	e := &Engine{
		engine: ptr,
	}

	runtime.SetFinalizer(e, func(e *Engine) {
		C.engine_shutdown(e.engine)
	})

	engine.Register("php", e, []string{".php"})
}
예제 #3
0
// Destroy shuts down and frees any resources related to the PHP engine bindings.
func (e *Engine) Destroy() {
	if e.engine == nil {
		return
	}

	for _, r := range e.receivers {
		r.Destroy()
	}

	e.receivers = nil

	for _, c := range e.contexts {
		c.Destroy()
	}

	e.contexts = nil

	C.engine_shutdown(e.engine)
	e.engine = nil
}