From 5e02bc3c84414c944d4ebe1a24401a6ba7cc7bd0 Mon Sep 17 00:00:00 2001 From: Unbit Date: Fri, 15 Feb 2013 12:26:45 +0100 Subject: [PATCH] UWSGI_ALARM is no more required --- plugins/go/src/uwsgi/uwsgi.go | 9 +++++++++ t/go/complextest.go | 1 + 2 files changed, 10 insertions(+) diff --git a/plugins/go/src/uwsgi/uwsgi.go b/plugins/go/src/uwsgi/uwsgi.go index 36522977..938c68e0 100644 --- a/plugins/go/src/uwsgi/uwsgi.go +++ b/plugins/go/src/uwsgi/uwsgi.go @@ -124,6 +124,15 @@ func RegisterSignal(signum int, who string, handler func(int)) bool { return false } +func Alarm(alarm string, msg string) { + a := C.CString(alarm) + defer C.free(unsafe.Pointer(a)) + m := C.CString(msg) + defer C.free(unsafe.Pointer(m)) + ml := len(msg) + C.uwsgi_alarm_trigger(a, m, C.size_t(ml)) +} + // get an item from the cache func CacheGet(key string) []byte { if (C.uwsgi.caches) == nil { diff --git a/t/go/complextest.go b/t/go/complextest.go index 4697f505..eddf77e5 100644 --- a/t/go/complextest.go +++ b/t/go/complextest.go @@ -18,6 +18,7 @@ func request_handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:]) fmt.Fprintf(w, "

Hi there, I love %s!

", r.URL.Path[1:]) fmt.Println("LOGSIZE: ", uwsgi.LogSize()) + uwsgi.Alarm("jabber", "Hello") go slow() }