Changeset 1689 in Sophya for trunk/ArchTOIPipe/Kernel/toisegment.h
- Timestamp:
- Oct 14, 2001, 1:56:14 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/toisegment.h
r1686 r1689 18 18 class TOISegmented : public TOIRegular { 19 19 public: 20 TOISegmented( );21 TOISegmented(string nm );20 TOISegmented(int bufsz=256, int maxseg=20); 21 TOISegmented(string nm, int bufsz=256, int maxseg=20); 22 22 ~TOISegmented(); 23 24 virtual double getData(int i); 25 virtual void getData(int i, double& data, uint_8& flag); 26 virtual void putData(int i, double value, uint_8 flag=0); 27 virtual void wontNeedBefore(int i); 28 virtual void putDone(); 29 30 31 virtual DataStatus isDataAvail(int iStart, int iEnd); 32 virtual DataStatus isDataAvail(int i); 33 virtual DataStatus isDataAvailNL(int iStart, int iEnd); // abstract 34 virtual void waitForData(int iStart, int iEnd); 35 virtual void waitForData(int i); 36 virtual void waitForAnyData(); 37 virtual int nextDataAvail(int iAfter); // abstract 38 virtual bool hasSomeData(); // abstract 39 virtual void doGetData(int i, double& data, uint_8& flag); // abs 40 virtual void doPutData(int i, double value, uint_8 flag=0); // abs 23 41 24 42 … … 27 45 class BufferView; 28 46 class MasterView; 47 48 MasterView* master; 29 49 30 50 … … 85 105 double getData(int sn); 86 106 uint_8 getFlag(int sn); 107 BufferView* getView(); // thread-specific 108 void putDone(); 87 109 88 110 protected: … … 90 112 void removeFromWaitList(BufferView* bv); 91 113 92 BufferView* getView(); // thread-specific93 114 94 115 friend class BufferView; 95 void signalWaitingViews(); 116 void signalWaitingViews(); // views are waiting on read 117 void signal(); // we are waiting on write 96 118 void nextSegment(); 119 void waitForCleaning(); 97 120 BufferView* createView(); 98 121 void updateView(BufferView*); // called on reader thread of the view … … 107 130 pthread_mutex_t views_mutex; // lock for master buffer list access 108 131 pthread_mutex_t write_mutex; // for write waiting 109 pthread_cond_t condv; // waiting (read or write) (write only ?)132 pthread_cond_t condv; // waiting for cleaning (on writer thread) 110 133 pthread_key_t buffer_key; // thread-specific buffer view 111 134 static void BufferDestroy(void *); 112 135 113 static const int NO_WAIT = 0; 114 static const int WAIT_READ = 1; 115 static const int WAIT_WRITE= 2; 116 int waitStatus; 136 bool waitingOnWrite; // wait on writer thread 117 137 118 138 set<BufferView*> waitingBuffers; … … 130 150 double getData(int sn); 131 151 uint_8 getFlag(int sn); 152 153 void wontNeedBefore(int sn); 132 154 133 155 protected: … … 142 164 int sn0; 143 165 int segmentSize; 166 int firstNeeded; 144 167 pthread_mutex_t mutex; // lock pour attente de segments 145 168 pthread_cond_t condv; // attente de segments (en lecture)
Note:
See TracChangeset
for help on using the changeset viewer.