Changeset 4:d061ad3be7fd in xplcommon for src
- Timestamp:
- 12/27/12 18:52:39 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/xplcommon
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/xplcommon/Makefile.am
r3 r4 22 22 include_xplcommon_HEADERS=\ 23 23 config.h \ 24 Thread.h 24 Thread.h \ 25 Waiter.h \ 26 WaitableEvent.h -
src/xplcommon/posix/Makefile.am
r3 r4 4 4 Thread.cc \ 5 5 Waitable.cc \ 6 Waiter.cc 6 Waiter.cc \ 7 WaitableEvent.cc 7 8 8 9 include_xplcommon_posixdir=$(includedir)/xplcommon/posix … … 10 11 Thread.h \ 11 12 Waitable.h \ 12 Waiter.h 13 Waiter.h \ 14 WaitableEvent.h -
src/xplcommon/posix/Thread.h
r3 r4 33 33 34 34 #include <pthread.h> 35 #include <unistd.h> 35 36 36 37 //------------------------------------------------------------------------------ … … 45 46 class Thread 46 47 { 48 public: 49 /** 50 * Sleep for the given number of milliseconds. 51 */ 52 static void sleep(unsigned millis); 53 47 54 private: 48 55 /** … … 84 91 //------------------------------------------------------------------------------ 85 92 93 inline void Thread::sleep(unsigned millis) 94 { 95 usleep(static_cast<useconds_t>(millis)*1000); 96 } 97 98 //------------------------------------------------------------------------------ 99 86 100 inline Thread::~Thread() 87 101 { -
src/xplcommon/posix/Waitable.cc
r3 r4 34 34 #include "Waiter.h" 35 35 36 #include <fcntl.h> 37 36 38 //------------------------------------------------------------------------------ 37 39 38 40 using xplcommon::posix::Waitable; 41 42 //------------------------------------------------------------------------------ 43 44 void Waitable::setNonBlocking(int fd) 45 { 46 fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); 47 } 39 48 40 49 //------------------------------------------------------------------------------ -
src/xplcommon/posix/Waitable.h
r3 r4 47 47 class Waitable 48 48 { 49 public: 50 /** 51 * Set the given file descriptor to non-blocking. 52 */ 53 static void setNonBlocking(int fd); 54 49 55 protected: 50 56 /**
Note:
See TracChangeset
for help on using the changeset viewer.