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

wait_event() default timeout #3

Closed
ghost opened this issue Jun 6, 2014 · 3 comments
Closed

wait_event() default timeout #3

ghost opened this issue Jun 6, 2014 · 3 comments

Comments

@ghost
Copy link

ghost commented Jun 6, 2014

Commit 966ce5a seems to imply that calling wait_event() with no timeout should wait forever. But this is not what happens: it passes -1, which will return immediately.

Well, I'm not entirely sure what behavior mpv_wait_event() should have. Currently, it accepts a relative timeout, and if the timeout is 0 or negative, it doesn't wait. Maybe this should be changed? E.g. the poll() system call interprets negative timeouts as infinite timeout.

Currently, you can pass an unrealistically high number like 1e20 to get an infinite timeout.

Slightly digressing from this, maybe the timeout should be an absolute target time (using mpv_get_time_us()), instead of a relative timeout?

@andre-d
Copy link
Owner

andre-d commented Jun 7, 2014

Absolute time seems silly to me, it could be built on top pretty easy (or with a different call if you want OS level realtime absolute based timing or whatever exists out there). I feel like < 0 should mean infinite, very high number seems like a hack.

@ghost
Copy link
Author

ghost commented Jun 7, 2014

Absolute time seems silly to me

pthread primitives also use an absolute timeout, so that wouldn't be too unusual.

@ghost
Copy link
Author

ghost commented Jun 7, 2014

OK, changed it - negative timeouts now mean infinite timeout.

@ghost ghost closed this as completed Jun 7, 2014
This issue was closed.
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

No branches or pull requests

1 participant