9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Steve Simon" <steve@quintile.net>
To: 9fans@cse.psu.edu
Subject: [9fans] OT: cannonical set of queue ops
Date: Wed,  6 Dec 2006 16:14:14 +0000	[thread overview]
Message-ID: <15215407ef3dbfddfed3946505e2dc78@quintile.net> (raw)

Hi,

Bit off topic

In an embedded system, we are trying to wrap up the specifics
of the RTOS we use and abstract it a little so we can switch
OS later (to a cheaper one :-)

We are therefore trying to come to a cannonical API, the only
part of this we are having problems are interlocked queues.

These are queues which the reader blocks if they are empty and
the writer blocks if full. They have an option for a timeout
which can be -1 to indicate forever or 0 for poll.

We have found a need for a either IsQueueEmpty() or PeekQueueHead()
entrypoint - a network driver is closing a connection a cleanup thread
needs to poll the queue so it can deallocate it once all the remaining data
has drained; we cannot just read the queue to see if its empty as this will
remove the head entry if there is one.

This is the one and only place we seem to need this so we are worried.

Are we suffering from a lack of vision, or is some way of checking the
number of items on a queue inevitable?

-Steve


             reply	other threads:[~2006-12-06 16:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-06 16:14 Steve Simon [this message]
2006-12-06 16:35 ` Richard Bilson
2006-12-06 22:36   ` LiteStar numnums
2006-12-06 22:58     ` Richard Bilson
2006-12-07  0:07       ` David Leimbach
2006-12-07 21:37 ` Russ Cox

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=15215407ef3dbfddfed3946505e2dc78@quintile.net \
    --to=steve@quintile.net \
    --cc=9fans@cse.psu.edu \
    /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).