[Bug 1673] Chain append and prepend with empty check
bugzilla-daemon at rtems.org
bugzilla-daemon at rtems.org
Thu Aug 19 09:14:57 UTC 2010
https://www.rtems.org/bugzilla/show_bug.cgi?id=1673
--- Comment #7 from Peer Stritzinger <peerst at gmail.com> 2010-08-19 04:14:56 CDT ---
(In reply to comment #5)
> > But I had a different application in mind: notify a producer if you took the
> > last one from the chain.
> > So the empty check would be after the last one was taken.
>
> I didn't think about multiple consumers. With at most one consumer we don't
> have race conditions here with the standard chain_get(). You notify the
> producer if the chain is empty. With multiple consumers you need the
> chain_get_with_empty_check().
That true. I was not sure if there is a race and I was to lazy to think it
through ;-)
> > With chain_get there is the question of what is returned.
> >
> > Because of this it might even make sense to have the
> >
> > rtems_chain_append_with_notification( chain, node, tid, event)
> >
> > and
> >
> > rtems_chain_get_with_notification (chain, tid, event) -> node
> >
> > functions instead. These were the functions Joel suggested to me in IRC.
> > Their disadvantage are of course that in theory they are less flexible. But in
> > practice they encapsulate a very common use case.
>
> In case of get we yield nothing here regarding the return value problem since
> we have to return a status code from the notification functions
> (rtems_event_send() may fail).
I agree.
--
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the bugs
mailing list