Module: xenomai-rpm Branch: for-upstream Commit: d0b4bb3f4ec669ac0b82b64cde811f90b02d2288 URL: http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=d0b4bb3f4ec669ac0b82b64cde811f90b02d2288
Author: Philippe Gerum <r...@xenomai.org> Date: Mon Mar 29 10:42:36 2010 +0200 rtipc/bufp: reset buffer descriptor upon r/w preemption In order to perform data copy while reading/writing data from/to a buffer descriptor in a lockless manner, we rely on a control token for detecting any preemption that shall lead to invalidating the current buffer, before redoing the data acquisition. Make sure to reset the buffer descriptor appropriately, before redoing the acquisition, so that the old contents are discarded. --- ksrc/drivers/ipc/bufp.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ksrc/drivers/ipc/bufp.c b/ksrc/drivers/ipc/bufp.c index 04b3209..7517b79 100644 --- a/ksrc/drivers/ipc/bufp.c +++ b/ksrc/drivers/ipc/bufp.c @@ -220,8 +220,10 @@ redo: * the message, we have to re-read the whole * thing. */ - if (sk->rdtoken != rdtoken) + if (sk->rdtoken != rdtoken) { + xnbufd_reset(bufd); goto redo; + } rdoff = (rdoff + n) % sk->bufsz; rbytes -= n; @@ -465,8 +467,10 @@ redo: * message, we have to write the whole thing * again. */ - if (rsk->wrtoken != wrtoken) + if (rsk->wrtoken != wrtoken) { + xnbufd_reset(bufd); goto redo; + } wroff = (wroff + n) % rsk->bufsz; wbytes -= n; _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git