Changeset 18301 for lang/c/mpio/trunk/mp/fdnotify.h
- Timestamp:
- 08/27/08 15:40:53 (4 months ago)
- Files:
-
- 1 modified
-
lang/c/mpio/trunk/mp/fdnotify.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/c/mpio/trunk/mp/fdnotify.h
r18183 r18301 17 17 // 18 18 19 #ifndef MP_FD _NOTIFY_H__20 #define MP_FD _NOTIFY_H__19 #ifndef MP_FDNOTIFY_H__ 20 #define MP_FDNOTIFY_H__ 21 21 22 #include <sys/types.h> 23 #include <sys/uio.h> 24 #include <unistd.h> 22 25 #include <stdexcept> 26 27 #ifndef MP_FDNOTIFY_VECTOR_SIZE 28 #define MP_FDNOTIFY_VECTOR_SIZE 64 29 #endif 23 30 24 31 namespace mp { … … 40 47 41 48 public: 49 int getfd(void) const { return m_pipe[0]; } 42 50 bool try_receive(NotifyObject* result); 43 int getfd(void) const { return m_pipe[PIPE_READ]; }44 51 45 inlinevoid send(const NotifyObject& obj);52 void send(const NotifyObject& obj); 46 53 47 54 private: 48 enum {49 PIPE_READ = 0,50 PIPE_WRITE = 1,51 };52 55 int m_pipe[2]; 53 char m_buffer[sizeof(NotifyObject)]; 54 size_t m_pos; 56 char m_buffer[sizeof(NotifyObject)*MP_FDNOTIFY_VECTOR_SIZE]; 57 struct iovec m_iovec[MP_FDNOTIFY_VECTOR_SIZE]; 58 struct iovec* m_head; 59 struct iovec* m_tail; 55 60 56 61 private: 57 void send_all(const char* p, const char* const endp);62 bool receive_next(NotifyObject* result); 58 63 59 64 private:
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)