mirror of
https://github.com/ii64/gouring.git
synced 2025-04-26 05:42:48 +02:00
doc: add example on readme
Signed-off-by: Nugraha <richiisei@gmail.com>
This commit is contained in:
parent
7fa3c507b1
commit
734c7883b8
1 changed files with 46 additions and 1 deletions
47
README.md
47
README.md
|
@ -1 +1,46 @@
|
|||
# gouring
|
||||
# gouring
|
||||
|
||||
[![License: MIT][1]](LICENSE)
|
||||
[![Go Reference][2]][3]
|
||||
|
||||
|
||||
```bash
|
||||
go get github.com/ii64/gouring
|
||||
```
|
||||
## Example
|
||||
|
||||
```go
|
||||
// setup
|
||||
h, err := gouring.New(256, 0)
|
||||
if err != nil { /*...*/ }
|
||||
defer h.Close()
|
||||
|
||||
sqe := h.GetSQE()
|
||||
b := []byte("io_uring!\n")
|
||||
PrepWrite(sqe, 1, &b[0], len(b), 0)
|
||||
|
||||
submitted, err := h.SubmitAndWait(1)
|
||||
if err != nil { /*...*/ }
|
||||
println(submitted) // 1
|
||||
|
||||
var cqe *gouring.IoUringCqe
|
||||
err = h.WaitCqe(&cqe)
|
||||
if err != nil { /*...*/ } // check also EINTR
|
||||
|
||||
_ = cqe.UserData
|
||||
_ = cqe.Res
|
||||
_ = cqe.Flags
|
||||
```
|
||||
|
||||
## Graph
|
||||
|
||||
_placeholder_
|
||||
|
||||
### Reference
|
||||
|
||||
https://github.com/axboe/liburing
|
||||
|
||||
|
||||
[1]: https://img.shields.io/badge/License-MIT-yellow.svg
|
||||
[2]: https://pkg.go.dev/badge/github.com/ii64/gouring.svg
|
||||
[3]: https://pkg.go.dev/github.com/ii64/gouring
|
Loading…
Add table
Reference in a new issue