36 lines
742 B
C
36 lines
742 B
C
|
|
#ifndef CGE_THREAD_CODEMAP_H
|
||
|
|
#define CGE_THREAD_CODEMAP_H
|
||
|
|
|
||
|
|
#include "Internal.h"
|
||
|
|
#include <errno.h>
|
||
|
|
|
||
|
|
static int errorToErrorCode(int value) {
|
||
|
|
switch (value) {
|
||
|
|
case 0:
|
||
|
|
return CGE_THREAD_EOK;
|
||
|
|
|
||
|
|
case ERROR_INVALID_PARAMETER:
|
||
|
|
case ERROR_INVALID_HANDLE:
|
||
|
|
case ERROR_NOT_SUPPORTED:
|
||
|
|
return CGE_THREAD_EINVAL;
|
||
|
|
|
||
|
|
case ERROR_NOT_ENOUGH_MEMORY:
|
||
|
|
case ERROR_OUTOFMEMORY:
|
||
|
|
case ERROR_MAX_THRDS_REACHED:
|
||
|
|
case ERROR_NO_SYSTEM_RESOURCES:
|
||
|
|
return CGE_THREAD_EOOM;
|
||
|
|
|
||
|
|
case ERROR_TIMEOUT:
|
||
|
|
return CGE_THREAD_ETIMEDOUT;
|
||
|
|
|
||
|
|
case ERROR_BUSY:
|
||
|
|
case ERROR_LOCK_VIOLATION:
|
||
|
|
return CGE_THREAD_EBUSY;
|
||
|
|
|
||
|
|
default:
|
||
|
|
return CGE_THREAD_EUNKNOWN;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif /* CGE_THREAD_CODEMAP_H */
|