Changeset 2386 in Sophya for trunk/ArchTOIPipe/Kernel/ringpipe.cc
- Timestamp:
- May 20, 2003, 12:10:09 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/ringpipe.cc
r2385 r2386 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: ringpipe.cc,v 1. 1 2003-05-19 23:31:29aubourg Exp $5 // $Id: ringpipe.cc,v 1.2 2003-05-20 10:10:08 aubourg Exp $ 6 6 7 7 #include "ringpipe.h" … … 15 15 #endif 16 16 17 RingPipe::RingPipe( ) {17 RingPipe::RingPipe(int ws) { 18 18 i0 = -1; 19 winSize = ws; 19 20 producer = NULL; 20 21 pthread_cond_init(&ringReady, NULL); … … 38 39 void RingPipe::putRing(int i, Ring const* ring) { 39 40 lock(); 41 waitForRoom(i); 40 42 if (i0 == -1) { 41 43 data.insert(data.begin(), 1, (Ring const*) NULL); … … 50 52 notify(); 51 53 unlock(); 54 } 55 56 void RingPipe::waitForRoom(int j) { 57 while (j-i0 >= winSize) { 58 wait(); 59 } 52 60 } 53 61 … … 91 99 data.erase(data.begin(), data.begin()+(i-i0)); 92 100 i0=i; 101 notify(); 93 102 } 94 103 unlock();
Note:
See TracChangeset
for help on using the changeset viewer.