mirror of
https://github.com/robotn/gohook.git
synced 2025-04-28 15:59:20 +08:00
made the dispatch process send events via json through a channel (the c kind), made another function that receives it and sends it trough another channel (the go kind) todo: remove usage of function-local data trough channel todo:find error that is causing the c channel to fill up?
21 lines
299 B
Go
21 lines
299 B
Go
package hook
|
|
|
|
/*
|
|
|
|
|
|
// #include "event/hook_async.h"
|
|
*/
|
|
import "C"
|
|
import "time"
|
|
|
|
//export go_send
|
|
func go_send(s *C.char) {
|
|
str := C.GoString(s)
|
|
ev <- str
|
|
}
|
|
|
|
//export go_sleep
|
|
func go_sleep(){
|
|
//todo: find smallest time that does not destroy the cpu utilization
|
|
time.Sleep(time.Millisecond*50)
|
|
} |