-
Notifications
You must be signed in to change notification settings - Fork 13
/
uring.go
48 lines (40 loc) · 995 Bytes
/
uring.go
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package gouring
func New(entries uint32, flags uint32) (*IoUring, error) {
ring := &IoUring{}
p := new(IoUringParams)
p.Flags = flags
err := io_uring_queue_init_params(entries, ring, p)
if err != nil {
return nil, err
}
return ring, nil
}
func NewWithParams(entries uint32, params *IoUringParams) (*IoUring, error) {
ring := &IoUring{}
if params == nil {
params = new(IoUringParams)
}
err := io_uring_queue_init_params(entries, ring, params)
if err != nil {
return nil, err
}
return ring, nil
}
func (h *IoUring) Close() {
h.io_uring_queue_exit()
}
func (h *IoUring) GetSqe() *IoUringSqe {
return h.io_uring_get_sqe()
}
func (h *IoUring) WaitCqe(cqePtr **IoUringCqe) error {
return h.io_uring_wait_cqe(cqePtr)
}
func (h *IoUring) SeenCqe(cqe *IoUringCqe) {
h.io_uring_cqe_seen(cqe)
}
func (h *IoUring) Submit() (int, error) {
return h.io_uring_submit()
}
func (h *IoUring) SubmitAndWait(waitNr uint32) (int, error) {
return h.io_uring_submit_and_wait(waitNr)
}