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

Unix.sleep does not return remaining seconds #4057

Closed
vicuna opened this issue Jun 30, 2006 · 2 comments
Closed

Unix.sleep does not return remaining seconds #4057

vicuna opened this issue Jun 30, 2006 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Jun 30, 2006

Original bug ID: 4057
Reporter: @mmottl
Status: acknowledged (set by @xavierleroy on 2006-07-26T10:01:58Z)
Resolution: open
Priority: normal
Severity: feature
Version: 3.10+dev
Category: otherlibs
Tags: patch
Monitored by: jm @mmottl smithjoshuab

Bug description

This is a problem with the present API: Unix.sleep does not return an integer, which makes it impossible to find out whether e.g. a signal has interrupted the system call, and how many seconds there are still left to sleep. Changing the API accordingly would lead to warnings only in existing code so this may be worth considering.

File attachments

@vicuna
Copy link
Author

vicuna commented Jul 9, 2006

Comment author: smithjoshuab

I've uploaded a patch to the 3.09.2 source that accomplishes this. It looks like adding this functionality (sleep returns int) to the threading code is not simple. I've added a kludge, but it's not a solution in the strict sense.

It does not break code, but will create warnings in extant code. I've tested it in non-threaded code and it works well. The thread-delay/sleep problem is bigger, though, and (to my poorly-skilled eyes) probably a major impediment to having this functionality implemented in a way that is responsible.

@xavierleroy
Copy link
Contributor

Since 4.07, I think, Unix.sleep and related functions restart the sleep when they are interrupted by a signal. This obviates the primary need for returning the time left. Moreover, I'm really not keen to change the type of the sleep functions and break a lot of code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants