|
Revision 372, 1.6 kB
(checked in by blackhedd, 2 years ago)
|
epoll support for #defer (loop-breaker)
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
#ifndef __FileStreamDescriptor__H_ |
|---|
| 22 |
#define __FileStreamDescriptor__H_ |
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
class FileStreamDescriptor: public EventableDescriptor |
|---|
| 31 |
{ |
|---|
| 32 |
public: |
|---|
| 33 |
FileStreamDescriptor (int, EventMachine_t*); |
|---|
| 34 |
virtual ~FileStreamDescriptor(); |
|---|
| 35 |
|
|---|
| 36 |
virtual void Read(); |
|---|
| 37 |
virtual void Write(); |
|---|
| 38 |
virtual void Heartbeat(); |
|---|
| 39 |
|
|---|
| 40 |
virtual bool SelectForRead(); |
|---|
| 41 |
virtual bool SelectForWrite(); |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
virtual int GetOutboundDataSize() {return OutboundDataSize;} |
|---|
| 45 |
|
|---|
| 46 |
protected: |
|---|
| 47 |
struct OutboundPage { |
|---|
| 48 |
OutboundPage (const char *b, int l, int o=0): Buffer(b), Length(l), Offset(o) {} |
|---|
| 49 |
void Free() {if (Buffer) free ((char*)Buffer); } |
|---|
| 50 |
const char *Buffer; |
|---|
| 51 |
int Length; |
|---|
| 52 |
int Offset; |
|---|
| 53 |
}; |
|---|
| 54 |
|
|---|
| 55 |
protected: |
|---|
| 56 |
deque<OutboundPage> OutboundPages; |
|---|
| 57 |
int OutboundDataSize; |
|---|
| 58 |
|
|---|
| 59 |
private: |
|---|
| 60 |
|
|---|
| 61 |
}; |
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
#endif |
|---|
| 65 |
|
|---|