12 #ifndef ECL_THREADS_THREAD_EXCEPTIONS_POS_HPP_
13 #define ECL_THREADS_THREAD_EXCEPTIONS_POS_HPP_
19 #include <ecl/config/ecl.hpp>
20 #if defined(ECL_IS_POSIX)
47 inline Error
ECL_LOCAL handlePthreadCreateError(
int error_result) {
48 switch (error_result) {
63 #if defined(ECL_HAS_EXCEPTIONS)
89 inline StandardException
ECL_LOCAL throwPthreadCreateException(
const char* loc,
int error_result) {
90 switch (error_result) {
91 case ( EINVAL ) :
return StandardException(loc,
InvalidInputError,
"Invalid settings in 'attr'");
92 case ( EAGAIN ) :
return StandardException(loc,
MemoryError,
"Insufficient resources to create another thread.");
93 case ( EPERM ) :
return StandardException(loc,
PermissionsError,
"No permission to set the scheduling policy and parameters specified in attr.");
94 default :
return StandardException(loc,
UnknownError,
"Unknown error.");
104 inline StandardException
ECL_LOCAL throwPthreadJoinException(
const char* loc,
int error_result) {
105 switch (error_result) {
106 case ( EDEADLK ) :
return StandardException(loc,
UsageError,
"Deadlock! Two threads tried to join each other or a thread tried to join itself.");
107 case ( EINVAL ) :
return StandardException(loc,
InvalidInputError,
"The specified thread is not joinable or another thread is already waiting to join with it.");
108 case ( ESRCH ) :
return StandardException(loc,
InvalidInputError,
"The specified thread (id) could not be found. Probably its already been joined?");
109 default :
return StandardException(loc,
UnknownError,
"Unknown error.");
118 inline StandardException
ECL_LOCAL throwPthreadCancelException(
const char* loc,
int error_result) {
119 switch (error_result) {
120 case ( ESRCH ) :
return StandardException(loc,
InvalidInputError,
"The specified thread (id) could not be found. Probably its already terminated.");
121 default :
return StandardException(loc,
UnknownError,
"Unknown error.");