Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pilot committed Dec 28, 2023
1 parent 6d8f331 commit 7c8fe84
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The goal of `event` is to provide a `BASIC` tool for building high performance n
## Getting Started

### Installing

To start using `event`, just run `go get`:

```sh
Expand All @@ -47,26 +48,26 @@ $ go get -u github.com/cheng-zhongliang/event

When the event is triggered, the callback function will be called.

### Option

The event is one-shot by default. If you want to persist, you can set the `EvPersist` option.

```go
ev := event.New(base, fd, event.EvRead|event.EvPersist, callback, arg)
```

### Read/Write/Timeout

These events can be used in combination.

```go
base := event.NewBase()
ev := event.New(base, fd, event.EvRead|event.Timeout|event.EvPersist, callback, arg)
ev := event.New(base, fd, event.EvRead|event.Timeout, callback, arg)
ev.Attach(time.Second)
```

When the fd is readable or timeout expires, this event will be triggered.

### Option

The event is one-shot by default. If you want to persist, you can set the `EvPersist` option.

```go
ev := event.New(base, fd, event.EvRead|event.EvPersist, callback, arg)
```

### Timer

The timer is a one-shot event that will be triggered after the timeout expires.
Expand Down

0 comments on commit 7c8fe84

Please sign in to comment.