SMP FIFO (one writer, one reader): #define SIZE 256 #define MASK (SIZE-1) int ri; int wi; int fifo[SIZE]; int fifo_read(void) { int r = -1; if (ri != wi) { int nri; r = fifo[ri]; nri = (ri + 1) & MASK; ri = nri; } return(r); } int fifo_write(int v) { int nwi = (wi + 1) & MASK; if (nwi != ri) { fifo[wi] = v; wi = nwi; return(0); } else { return(-1); } } int fifo_ready() { return((wi - ri) & MASK) } int fifo_space() { return(SIZE - nready() - 1); } To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
- Re: Is there spinlocks/semaphor... Alfred Perlstein
- Re: Is there spinlocks/semaphor... Matthew Dillon
- Re: Is there spinlocks/semaphor... Brad Knowles
- Re: Is there spinlocks/semaphor... David Holloway
- Re: Is there spinlocks/semaphor... Warner Losh
- Re: Is there spinlocks/semaphores availa... Warner Losh
- Re: Is there spinlocks/semaphores available for driv... Warner Losh
- Re: Is there spinlocks/semaphores available for ... Andrew Reilly
- Re: Is there spinlocks/semaphores available for drivers? Warner Losh
- Re: Is there spinlocks/semaphores available for drivers? Matthew Dillon
- Matthew Dillon