From: Hannes Mayer <h.mayer@domain.hid>
To: adeos-main@gna.org
Subject: [Adeos-main] LRTBF par-log.c & adeos_critical_enter question
Date: Mon, 11 Jul 2005 16:05:24 +0200 [thread overview]
Message-ID: <42D27CA4.5080308@domain.hid> (raw)
Hi all! (Philippe? Kristian? :-)
Over the weekend I was pondering over the LRTBF par-log.c example and used
the circular buffer for one of my own examples:
One question arose - which actually causes a problem too:
In par-log.c in read_proc: why do you set disable_timer ?
In read_proc there is the while loop:
flags = adeos_critical_enter (NULL);
while (read_pos != write_pos && len <= (count - MAX_STR_LEN )) {
[...]
}
adeos_critical_exit (flags);
After adeos_critical_enter, interrupts are disabled anyway (right?), so no
modification of read_pos or write_pos is possible and reading over the
proc file is not disturbed.
Furthermore in read_proc you reset disable_timer only after the complete
buffer was read via the proc file:
if (read_pos == write_pos) {
disable_timer = 0;
The problem:
While some user-space app is reading from the proc file, nothing is written
to the buffer and this causes data loss.
IMO, it would be best, if writing to the buffer is not disabled in read_proc.
In the actual data copying action in read_proc/while-loop no interrupt can
interfer - and if not everything from the buffer was read in the first place,
there is no problem if some data is added to the buffer until the next read
action occurs.
Maybe I'm overlooking something here - thanks for any comments and help! :-)
Best regards,
Hannes.
reply other threads:[~2005-07-11 14:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=42D27CA4.5080308@domain.hid \
--to=h.mayer@domain.hid \
--cc=adeos-main@gna.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.