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
setitimer, getitimer wrapper #46493
Comments
Right now Python misses a wrapper for setitimer and getitimer and I I'm attaching a standalone module, but if it gets to be included in Improvements are welcomed. |
I forgot to remove an unwanted comment from it =) |
I can see nothing wrong with including setitimer support for systems So whoever wants to complete it, feel free to produce a complete patch |
Martin, thanks for supporting the idea. I'm attaching a patch. It is against rev 61255, py3k branch. Documentation in "Doc/" and tests aren't done yet, if someone want to |
I noticed that I forgot to change setitimer and getitimer functions from I'm attaching a patch that should be applied after the previous one to |
Patch review:
|
Thanks for the review, corrections and suggestions Georg. For the first three items: I will be working on this later today. For the last item: "which" is one of those three new constants added. I I still have to write doc and tests. |
I'm attaching another patch, this should be applied after the other ones |
Updated Doc/library/signal.rst, follows a patch. |
I've done some tests for getitimer/setitimer, diff is attached. |
Could you please put all changes in one complete patch? It's much easier |
Complete patch attached |
I'd like to also see this in 2.6. Should I update the patch (if it |
If you are going to backport it to 2.6, then the C wrapper should be |
Okay, the patch applies just fine (besides configure, which must be |
Thanks for the patch. Committed as r61847 and r61848 |
Reopening. Apparently, the tests fail on FreeBSD; see http://www.python.org/dev/buildbot/trunk/x86%20FreeBSD%203%20trunk/builds/77/step-test/0 Can you please look into this? |
I'm investigating the problem loewis, thanks for reporting. But it would Also some changes were made to the original patch: neal.norwitz did a commit where he says: jeffrey.yasskin said: followed by these changes: signal.setitimer(self.itimer, 0.2) (old) and added: |
FreeBSD's man page for setitimer/getitimer doesn't look different from Also sorry for various typos in my last message. |
Trent Nelson kindly gave me access to his FreeBSD 6.2 buildbot so I had I started searching in the FreeBSD bug tracker and found this issue: I've also done a very simple "test" in C, just to demonstrate that this #include <stdio.h>
#include <signal.h>
#include <sys/time.h>
void h(int signo)
{
struct itimerval t;
getitimer(ITIMER_PROF, &t);
printf("%d %d\n", t.it_value.tv_sec, t.it_value.tv_usec);
printf("deactive ITIMER_PROF\n");
t.it_value.tv_sec = 0;
t.it_value.tv_usec = 0;
setitimer(ITIMER_PROF, &t, &t);
}
int main(void)
{
struct itimerval ival; ival.it_value.tv_sec = 1;
ival.it_value.tv_usec = 0;
ival.it_interval.tv_sec = 1;
ival.it_interval.tv_usec = 0; signal(SIGPROF, h);
printf("%d\n", setitimer(ITIMER_PROF, &ival, NULL));
alarm(2);
while (1) {
getitimer(ITIMER_PROF, &ival);
if (ival.it_value.tv_sec == 0 && ival.it_value.tv_usec == 0)
break;
}
return 0;
} When I compile this using -lc_r then the callback "h" is never called Should further discussion be moved to python-dev ? I'm somewhat stuck on |
Discussing on python-dev is fine. An acceptable solution would be to |
Closing this issue as the main functionality is committed. See issue |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: