Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use Timeout #332

Merged
merged 11 commits into from
Jan 23, 2024
Merged

use Timeout #332

merged 11 commits into from
Jan 23, 2024

Conversation

lihuiba
Copy link
Collaborator

@lihuiba lihuiba commented Jan 17, 2024

thread, io engines, socket

move sat_add(), sat_sub() into common/utility.h, reimplemented with compiler intrinsic, instead of inline assembly.

update the interface of class Timeout slightly

@lihuiba lihuiba marked this pull request as ready for review January 19, 2024 01:17
@liulanzheng
Copy link
Collaborator

These "fix" commits should ideally be squashed into one.

common/timeout.h Outdated
operator uint64_t() const { return timeout(); }
operator bool () const { return m_expire > now; }
uint64_t timeout_us() const { return timeout(); }
uint64_t timeout_ms() const { return divide(timeout(), 1000); }
Copy link
Collaborator

@beef9999 beef9999 Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

void f(Timeout timeout) {
    if (timeout) do_xx();
    if (timeout.expired()) do_xx();
}

感觉后者的API更清楚一点

@lihuiba
Copy link
Collaborator Author

lihuiba commented Jan 22, 2024

These "fix" commits should ideally be squashed into one.

will be squashed merged

@lihuiba lihuiba merged commit ac2fd2d into alibaba:main Jan 23, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants