Skip to content

wait should be reinitialized before subsequent calls to select #2

@morgant

Description

@morgant

From the select man page on OpenBSD 6.6 (my bold):

If timeout is a non-null pointer, it specifies a maximum interval to wait
for the selection to complete. If timeout is a null pointer, the select
blocks indefinitely. To effect a poll, the timeout argument should be
non-null, pointing to a zero-valued timeval structure. timeout is not
changed by select(), and may be reused on subsequent calls; however, it
is good style to re-initialize it before each invocation of select().

select is used in the primary while loop in main(), but wait is not reinitialized between uses.

I'm not entirely sure of the use of select in this application, but I believe it's allowing CPU time for other applications and slowing the primary while loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions