feat(c/libuv): Add tcp, udp, poll, core, stream, err features

feat(c/io): add libuv async io with io, tcp, udp, timer, dns, loop

feat(c/io): add libuv async io with stream, req, handle

feat(c/libuv): rename c/io to c/libuv, and improve errro, net, handle, stream

feat(c/libuv): Add a libuv demo: echo_server

refactor(c/libuv): Adjust comments and file names to accommodate merge
This commit is contained in:
赵英杰
2024-07-19 15:17:20 +08:00
committed by hackerchai
parent 545f9f2cca
commit e9d4328fad
5 changed files with 895 additions and 74 deletions

42
c/libuv/timer.go Normal file
View File

@@ -0,0 +1,42 @@
package libuv
import (
"github.com/goplus/llgo/c"
_ "unsafe"
)
// llgo:type C
type TimerCb func(timer *Timer)
/* TimerT related function and method */
//go:linkname InitTimer C.uv_timer_init
func InitTimer(loop *Loop, timer *Timer) c.Int
// llgo:link (*Timer).Start C.uv_timer_start
func (timer *Timer) Start(cb TimerCb, timeout uint64, repeat uint64) c.Int {
return 0
}
// llgo:link (*Timer).Stop C.uv_timer_stop
func (timer *Timer) Stop() c.Int {
return 0
}
// llgo:link (*Timer).Again C.uv_timer_again
func (timer *Timer) Again() c.Int {
return 0
}
// llgo:link (*Timer).SetRepeat C.uv_timer_set_repeat
func (timer *Timer) SetRepeat(repeat uint64) {}
// llgo:link (*Timer).GetRepeat C.uv_timer_get_repeat
func (timer *Timer) GetRepeat() uint64 {
return 0
}
// llgo:link (*Timer).GetDueIn C.uv_timer_get_due_in
func (timer *Timer) GetDueIn() uint64 {
return 0
}