From: Matthias Grimm <matthias.grimm@htp-tel.de>
To: linuxppc-dev@lists.linuxppc.org
Subject: Any known problems with usleep() in 2.6.7?
Date: Tue, 13 Jul 2004 21:34:57 +0200 [thread overview]
Message-ID: <200407132134.58687.matthias.grimm@htp-tel.de> (raw)
Hi,
Recently I have had a strange phenomenon with kernel 2.6.7: sometimes usleep()
doesn't return. it hangs. I haven't discovered yet under which circumstances
usleep() doesn't work. With kernel 2.4 I haven't seen this behaviour.
Are there any known problems with usleep() in kernel 2.6.7?
Is there a better method to wait a while?
I attached the code fragment with the problematic usleep() call. that. Maybe
there is something wrong I haven't seen yet. I would appreciate every hint.
I know that I should check the return value of fork() for error but this has
nothing to do with the usleep() problem, because the child has been created.
Best Regards
Matthias Grimm
--------------
pid = fork();
if (pid == 0) {
for (i=0; i < maxfiles; i++)
close(i); /* close all possible file handles */
open("/dev/null", O_RDONLY); /* STDIN */
open("/dev/null", O_WRONLY); /* STDOUT */
open("/dev/null", O_WRONLY); /* STDERR */
execv(argv[0], argv);
exit(99);
}
rc = E_CLDKILL;
for (i=base->timeforcmd * 10; i > 0; i--) {
usleep(100000); /* sleep 100ms */
if (waitpid (pid, &status, WNOHANG)) {
if (WIFEXITED(status)) {
if ((base->rc = WEXITSTATUS(status)))
rc = E_CLDEXIT;
else
rc = 0;
} else if (WIFSIGNALED(status))
rc = E_CLDSIG;
break;
}
}
if (i == 0)
kill (pid, SIGKILL);
---------
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
** This list is shutting down 7/24/2004.
next reply other threads:[~2004-07-13 19:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-13 19:34 Matthias Grimm [this message]
2004-07-16 18:56 ` Any known problems with usleep() in 2.6.7? Matthias Grimm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200407132134.58687.matthias.grimm@htp-tel.de \
--to=matthias.grimm@htp-tel.de \
--cc=linuxppc-dev@lists.linuxppc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).