From: Patrick Plattes <patrick@erdbeere.net>
To: linux-kernel@vger.kernel.org
Subject: semaphore understanding: sys_semtimedop()
Date: Mon, 16 May 2005 22:17:04 +0200 [thread overview]
Message-ID: <20050516201704.GA9836@erdbeere.net> (raw)
Hello,
i have a question about this little code snippet, found in
sys_semtimedop() (ipc/sem.c):
for (sop = sops; sop < sops + nsops; sop++) {
if (sop->sem_num >= max)
max = sop->sem_num;
if (sop->sem_flg & SEM_UNDO)
undos++;
if (sop->sem_op < 0)
decrease = 1;
if (sop->sem_op > 0)
alter = 1;
}
alter |= decrease;
The variable decrease will never be used again in this
function, so why this intricate code? Isn't this much easier and works
also:
for (sop = sops; sop < sops + nsops; sop++) {
if (sop->sem_num >= max)
max = sop->sem_num;
if (sop->sem_flg & SEM_UNDO)
undos++;
if (sop->sem_op != 0)
alter = 1;
}
Maybe i'm totally wrong, so please correct me and don't shoot me up,
'cause i'm not a os developer.
Thanks,
Patrick
next reply other threads:[~2005-05-16 20:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-16 20:17 Patrick Plattes [this message]
2005-05-22 5:21 ` semaphore understanding: sys_semtimedop() randy_dunlap
2005-05-22 6:49 ` Manfred Spraul
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=20050516201704.GA9836@erdbeere.net \
--to=patrick@erdbeere.net \
--cc=linux-kernel@vger.kernel.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