Changeset 1485:3a149151a9cd
- Timestamp:
- 08/29/10 14:59:23 (18 months ago)
- Branch:
- default
- Location:
- sources
- Files:
-
- 1 added
- 13 edited
-
examples/pc_process/test.cc (modified) (1 diff)
-
include/libdodo/exceptionBasic.h (modified) (1 diff)
-
include/libdodo/pc.h (modified) (1 diff)
-
include/libdodo/pcNotificationThreadEx.h (modified) (1 diff)
-
include/libdodo/pcSyncDataObject.h (modified) (1 diff)
-
include/libdodo/pcSyncDataObjectEx.h (added)
-
include/libdodo/pcSyncProcess.h (modified) (1 diff)
-
include/libdodo/pcSyncProcessEx.h (modified) (1 diff)
-
include/libdodo/pcSyncProtector.h (modified) (1 diff)
-
include/libdodo/pcSyncThread.h (modified) (1 diff)
-
include/libdodo/pcSyncThreadEx.h (modified) (1 diff)
-
src/pcSyncDataObject.cc (modified) (2 diffs)
-
src/pcSyncProcess.cc (modified) (5 diffs)
-
src/pcSyncThread.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sources/examples/pc_process/test.cc
r1472 r1485 48 48 cout << endl << memory << ": " << tools::time::now() << endl, cout.flush(); 49 49 } dodo_catch (exception::basic *e) { 50 cout << (dodo::string)*e << e->line << endl, cout.flush();50 cout << (dodo::string)*e << " " << e->file << ":" << e->line << endl, cout.flush(); 51 51 } 52 52 -
sources/include/libdodo/exceptionBasic.h
r1480 r1485 104 104 MODULE_PCSYNCTHREAD, 105 105 MODULE_PCSYNCPROCESS, 106 MODULE_PCSYNCDATAOBJECT, 106 107 MODULE_PCNOTIFICATIONTHREAD, 107 108 MODULE_GRAPHICSIMAGE, -
sources/include/libdodo/pc.h
r1468 r1485 40 40 #include <libdodo/pcExecutionSchedulerEx.h> 41 41 #include <libdodo/pcExecutionWorkqueue.h> 42 #include <libdodo/pcNotificationThread.h> 43 #include <libdodo/pcNotificationThreadEx.h> 42 44 #include <libdodo/pcSyncDataObject.h> 45 #include <libdodo/pcSyncDataObjectEx.h> 43 46 #include <libdodo/pcSyncProcess.h> 44 47 #include <libdodo/pcSyncProcessEx.h> -
sources/include/libdodo/pcNotificationThreadEx.h
r1479 r1485 39 39 namespace notification { 40 40 /** 41 * libdodo defined errors42 */43 enum threadExR {44 THREADEX_CANNOTLOCK45 };46 47 /**48 * explanations for libdodo defined errors49 */50 #define PCNOTIFICATIONTHREADEX_CANNOTLOCK_STR "Item is currently locked, timeout exhousted"51 52 /**53 41 * IDs of functions where exception might be thrown 54 42 */ -
sources/include/libdodo/pcSyncDataObject.h
r1439 r1485 75 75 * @param timeout defines wait timeout for unlock in microseconds 76 76 * @note if timeout is 0 it will wait infinitely 77 * raises an exception if lock was not acquired within given timeout 77 78 */ 78 79 virtual void *acquire(unsigned long timeout = 0); -
sources/include/libdodo/pcSyncProcess.h
r1439 r1485 71 71 /** 72 72 * lock 73 * @return false if lock was not acquired within given timeout 73 74 * @param timeout defines wait timeout for unlock in microseconds 74 75 * @note if timeout is 0 it will wait infinitely 75 76 */ 76 virtual voidacquire(unsigned long timeout = 0);77 virtual bool acquire(unsigned long timeout = 0); 77 78 78 79 /** -
sources/include/libdodo/pcSyncProcessEx.h
r1439 r1485 39 39 namespace sync { 40 40 /** 41 * libdodo defined errors42 */43 enum processExR {44 PROCESSEX_CANNOTLOCK,45 };46 47 /**48 * explanations for libdodo defined errors49 */50 #define PCSYNCPROCESSEX_CANNOTLOCK_STR "Item is currently locked, timeout exhousted"51 52 /**53 41 * IDs of functions where exception might be thrown 54 42 */ -
sources/include/libdodo/pcSyncProtector.h
r1439 r1485 50 50 /** 51 51 * lock 52 * @return false if lock was not acquired within given timeout 52 53 * @param timeout defines wait timeout for unlock in microseconds 53 54 * @note if timeout is 0 it will wait infinitely 54 55 */ 55 virtual voidacquire(unsigned long timeout) = 0;56 virtual bool acquire(unsigned long timeout) = 0; 56 57 57 58 /** -
sources/include/libdodo/pcSyncThread.h
r1479 r1485 71 71 /** 72 72 * lock 73 * @return false if lock was not acquired within given timeout 73 74 * @param timeout defines wait timeout for unlock in microseconds 74 75 * @note if timeout is 0 it will wait infinitely 75 76 */ 76 virtual voidacquire(unsigned long timeout = 0);77 virtual bool acquire(unsigned long timeout = 0); 77 78 78 79 /** -
sources/include/libdodo/pcSyncThreadEx.h
r1439 r1485 39 39 namespace sync { 40 40 /** 41 * libdodo defined errors42 */43 enum threadExR {44 THREADEX_CANNOTLOCK45 };46 47 /**48 * explanations for libdodo defined errors49 */50 #define PCSYNCTHREADEX_CANNOTLOCK_STR "Item is currently locked, timeout exhousted"51 52 /**53 41 * IDs of functions where exception might be thrown 54 42 */ -
sources/src/pcSyncDataObject.cc
r1439 r1485 31 31 32 32 #include <libdodo/pcSyncDataObject.h> 33 #include <libdodo/pcSyncDataObjectEx.h> 33 34 #include <libdodo/pcSyncProtector.h> 34 35 #include <libdodo/pcSyncStack.h> … … 72 73 object::acquire(unsigned long timeout) 73 74 { 74 lock.acquire(timeout); 75 if (!lock.acquire(timeout)) 76 dodo_throw exception::basic(exception::MODULE_PCSYNCDATAOBJECT, DATAOBJECTEX_ACQUIRE, exception::ERRNO_LIBDODO, DATAOBJECTEX_CANNOTLOCK, PCSYNCDATAOBJECTEX_CANNOTLOCK_STR, __LINE__, __FILE__); 77 75 78 return data; 76 79 } -
sources/src/pcSyncProcess.cc
r1477 r1485 213 213 //------------------------------------------------------------------- 214 214 215 void 215 bool 216 216 process::acquire(unsigned long microseconds) 217 217 { … … 221 221 ++recursive; 222 222 223 return ;223 return true; 224 224 } 225 225 … … 235 235 if (semtimedop(lock->keeper, lock->operations, 1, &ts) != 0) { 236 236 if (errno == EAGAIN) 237 dodo_throw exception::basic(exception::MODULE_PCSYNCPROCESS, PROCESSEX_ACQUIRE, exception::ERRNO_LIBDODO, PROCESSEX_CANNOTLOCK, PCSYNCPROCESSEX_CANNOTLOCK_STR, __LINE__, __FILE__);237 return false; 238 238 else 239 239 dodo_throw exception::basic(exception::MODULE_PCSYNCPROCESS, PROCESSEX_ACQUIRE, exception::ERRNO_ERRNO, errno, strerror(errno), __LINE__, __FILE__); … … 258 258 if (sem_timedwait(lock->keeper, &ts) != 0) { 259 259 if (errno == ETIMEDOUT) 260 dodo_throw exception::basic(exception::MODULE_PCSYNCPROCESS, PROCESSEX_ACQUIRE, exception::ERRNO_LIBDODO, PROCESSEX_CANNOTLOCK, PCSYNCPROCESSEX_CANNOTLOCK_STR, __LINE__, __FILE__);260 return false; 261 261 else 262 262 dodo_throw exception::basic(exception::MODULE_PCSYNCPROCESS, PROCESSEX_ACQUIRE, exception::ERRNO_ERRNO, errno, strerror(errno), __LINE__, __FILE__); … … 267 267 current = pid; 268 268 recursive = 0; 269 270 return true; 269 271 } 270 272 -
sources/src/pcSyncThread.cc
r1479 r1485 105 105 //------------------------------------------------------------------- 106 106 107 void 107 bool 108 108 thread::acquire(unsigned long microseconds) 109 109 { … … 128 128 if (errno != 0) { 129 129 if (errno == ETIMEDOUT) 130 dodo_throw exception::basic(exception::MODULE_PCSYNCTHREAD, THREADEX_ACQUIRE, exception::ERRNO_ERRNO, THREADEX_CANNOTLOCK, PCSYNCTHREADEX_CANNOTLOCK_STR, __LINE__, __FILE__);130 return false; 131 131 else 132 132 dodo_throw exception::basic(exception::MODULE_PCSYNCTHREAD, THREADEX_ACQUIRE, exception::ERRNO_ERRNO, errno, strerror(errno), __LINE__, __FILE__); … … 134 134 } 135 135 #endif 136 137 return true; 136 138 } 137 139
Note: See TracChangeset
for help on using the changeset viewer.
