| Age | Commit message (Collapse) | Author |
|
Go 1.22 now support for-range on numeric value.
|
|
|
|
HTTP request now implicitly create request with context.
Any false positive related to not closing HTTP response body has been
annotated with "nolint:bodyclose".
In the example code, use consistent "// Output:" comment format, by
prefixing with single space.
Any comment on code now also prefixing with single space.
An error returned without variables now use [errors.New] instead of
[fmt.Errorf].
Any error returned using [fmt.Errorf] now wrapped using "%w" instead of
"%s".
Also, replace error checking using [errors.Is] or [errors.As], instead
of using equal/not-equal operator.
Any statement like "x = x OP y" now replaced with "x OP= y".
Also, swap statement is simplified using "x, y = y, x".
Any switch statement with single case now replaced with if-condition.
Any call to defer on function or program that call [os.Exit], now
replaced by calling the deferred function directly.
Any if-else condition now replaced with switch statement, if possible.
|
|
Previously, the Pool's WaitRead and WaitReadEVent methods return list of
file descriptor (fd) and keeps the fd in the pool.
In case we want to process the returned fd concurrently, by running it
in different goroutine, the next call WaitRead may return the same fd
if its goroutine not fast enought to read from fd.
This changes fix this issue by removing list of fd from poll and set the
fd flag to blocking mode again after returning it from WaitRead or
WaitReadEvent.
This changes also remove the ReregisterRead and ReregisterEvent methods
since it is not applicable anymore.
|
|
The PollEvent contains file descriptor and the underlying event
based on OS, unix.EpollEvent on Linux or unix.Kevent_t on BSD.
The Poll interface provides two APIs to works with PollEvent,
WaitReadEvents that return list of PollEvent ready for read, and
ReregisterEvent to register the event back to poll (only for Linux).
|
|
In case the user of poll changes the fd flags to block for reading
or writing and forgot to set it non-block again, this may cause an issue
on the poll.
|
|
|
|
|
|
|
|
|
|
While at it, add copyright information.
|
|
This is the first implementation of (almost) generic polling.
The Poll currently only support the Read events from now, because the
most common use case is for handling multiple socket without using
goroutines.
|