Changeset 6:81a0ade149e1 in xplcommon for src
- Timestamp:
- 12/29/12 06:40:32 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/xplcommon
- Files:
-
- 19 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/xplcommon/Makefile.am
r5 r6 23 23 include_xplcommon_HEADERS=\ 24 24 config.h \ 25 types.h \ 26 Failable.h \ 25 27 Thread.h \ 26 28 Waiter.h \ -
src/xplcommon/posix/Makefile.am
r4 r6 3 3 libxplcommon_posix_la_SOURCES = \ 4 4 Thread.cc \ 5 Waitable.cc \ 6 Waiter.cc \ 7 WaitableEvent.cc 5 Waitable.cc \ 6 Waiter.cc \ 7 WaitableEvent.cc \ 8 ReadingBuffer.cc \ 9 WritingBuffer.cc \ 10 BufferedWaitable.cc \ 11 Acceptor.cc \ 12 ServerSocket.cc \ 13 Socket.cc \ 14 Connector.cc \ 15 ClientSocket.cc 8 16 9 17 include_xplcommon_posixdir=$(includedir)/xplcommon/posix … … 12 20 Waitable.h \ 13 21 Waiter.h \ 14 WaitableEvent.h 22 WaitableEvent.h \ 23 WaitableBuffer.h \ 24 ReadingBuffer.h \ 25 WritingBuffer.h \ 26 BufferedWaitable.h \ 27 Acceptor.h \ 28 ServerSocket.h \ 29 Socket.h \ 30 Connector.h \ 31 ClientSocket.h -
src/xplcommon/posix/Waitable.h
r4 r6 82 82 83 83 /** 84 * Indicate if this waitable is valid, i.e. the file descriptor is 85 * non-negative. 86 */ 87 bool isValid() const; 88 89 /** 90 * Determine if the waitable is ready or not, i.e. if there is no 91 * need to wait for it. 92 * 93 * It first checks the events. If they are 0, the waitable is 94 * ready. Then it calls isReady() and returns the result of that 95 * function. 96 */ 97 bool ready(); 98 99 protected: 100 /** 84 101 * Indicate if the waitable is ready, i.e. there is no need to 85 102 * wait for it. 86 103 * 87 * Calling this function should not deleted the ready 88 * indication. It should be deleted by actually processing the data. 104 * Calling this function should not delete the ready 105 * indication. It should be deleted by actually processing the 106 * data. 89 107 */ 90 virtual bool ready() = 0;108 virtual bool isReady() = 0; 91 109 92 protected:93 110 /** 94 111 * Handle the given events. … … 98 115 friend class Waiter; 99 116 }; 117 118 //------------------------------------------------------------------------------ 119 // Inline defintions 120 //------------------------------------------------------------------------------ 121 122 inline bool Waitable::isValid() const 123 { 124 return fd>=0; 125 } 126 127 //------------------------------------------------------------------------------ 128 129 inline bool Waitable::ready() 130 { 131 return (events==0) || isReady(); 132 } 100 133 101 134 //------------------------------------------------------------------------------ -
src/xplcommon/posix/WaitableEvent.cc
r4 r6 62 62 //------------------------------------------------------------------------------ 63 63 64 bool WaitableEvent::ready()65 {66 return fired;67 }68 69 //------------------------------------------------------------------------------70 71 64 void WaitableEvent::fire() 72 65 { … … 90 83 return false; 91 84 } 85 } 86 87 //------------------------------------------------------------------------------ 88 89 bool WaitableEvent::isReady() 90 { 91 return fired; 92 92 } 93 93 -
src/xplcommon/posix/WaitableEvent.h
r4 r6 63 63 64 64 /** 65 * Check if the event is fired or not.66 */67 virtual bool ready();68 69 /**70 65 * Fire the event. 71 66 */ … … 79 74 80 75 protected: 76 /** 77 * Check if the event is fired or not. 78 */ 79 virtual bool isReady(); 80 81 81 /** 82 82 * Handle the given events.
Note:
See TracChangeset
for help on using the changeset viewer.