Changeset 2298 for trunk/src/emx/include/InnoTekLIBC/backend.h
- Timestamp:
- Aug 22, 2005, 2:14:50 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/include/InnoTekLIBC/backend.h
-
Property cvs2svn:cvs-rev
changed from
1.30
to1.31
r2297 r2298 967 967 * @{ */ 968 968 969 /** 970 * Safe Mutex Semaphore structure. 971 * 972 * For shared semaphores this structure must be in shared memory so all users 973 * actually use the very same structure. 974 */ 975 typedef struct __LIBC_SAFESEMMTX 976 { 977 #ifdef __OS2__ 978 /** Mutex handle. */ 979 unsigned long hmtx; 980 #endif 981 } __LIBC_SAFESEMMTX; 982 /** Pointer to a SAFESEM Mutex structure. */ 983 typedef __LIBC_SAFESEMMTX *__LIBC_PSAFESEMMTX; 984 969 985 /** 970 986 * Creates a safe mutex sem. … … 972 988 * @returns 0 on success. 973 989 * @returns Negative error code (errno.h) on failure. 974 * @param p hmtx Where to store the semaphore handle.990 * @param pmtx Pointer to the semaphore structure to initialize. 975 991 * @param fShared Set if the semaphore should be sharable between processes. 976 992 */ 977 int __libc_Back_safesemMtxCreate( uintptr_t *phmtx, int fShared);993 int __libc_Back_safesemMtxCreate(__LIBC_PSAFESEMMTX pmtx, int fShared); 978 994 979 995 /** … … 982 998 * @returns 0 on success. 983 999 * @returns Negative error code (errno.h) on failure. 984 * @param hmtx The semaphore handle.985 */ 986 int __libc_Back_safesemMtxOpen( uintptr_t hmtx);1000 * @param pmtx Pointer to the semaphore structure. 1001 */ 1002 int __libc_Back_safesemMtxOpen(__LIBC_PSAFESEMMTX pmtx); 987 1003 988 1004 /** … … 991 1007 * @returns 0 on success. 992 1008 * @returns Negative error code (errno.h) on failure. 993 * @param hmtx The semaphore handle.994 */ 995 int __libc_Back_safesemMtxClose( uintptr_t hmtx);1009 * @param pmtx Pointer to the semaphore structure. 1010 */ 1011 int __libc_Back_safesemMtxClose(__LIBC_PSAFESEMMTX pmtx); 996 1012 997 1013 /** … … 1000 1016 * @returns 0 on success. 1001 1017 * @returns Negative errno on failure. 1002 * @param hmtx Handle to the mutex.1003 */ 1004 int __libc_Back_safesemMtxLock( uintptr_t hmtx);1018 * @param pmtx Pointer to the semaphore structure. 1019 */ 1020 int __libc_Back_safesemMtxLock(__LIBC_PSAFESEMMTX pmtx); 1005 1021 1006 1022 /** … … 1009 1025 * @returns 0 on success. 1010 1026 * @returns Negative errno on failure. 1011 * @param hmtx Handle to the mutex. 1012 */ 1013 int __libc_Back_safesemMtxUnlock(uintptr_t hmtx); 1027 * @param pmtx Pointer to the semaphore structure. 1028 */ 1029 int __libc_Back_safesemMtxUnlock(__LIBC_PSAFESEMMTX pmtx); 1030 1031 1032 /** 1033 * Safe Event Semaphore structure. 1034 * 1035 * For shared semaphores this structure must be in shared memory so all users 1036 * actually use the very same structure. 1037 * 1038 * @remark The event semaphore business is difficult because the lack of 1039 * atomic mutex release + event wait apis in OS/2. We have to 1040 * jump around the place to get this working nearly safly... 1041 */ 1042 typedef struct __LIBC_SAFESEMEV 1043 { 1044 #ifdef __OS2__ 1045 /** The event semaphore. */ 1046 unsigned long hev; 1047 #endif 1048 /** Number of threads which are supposed to be blocking on the above event semaphore. */ 1049 uint32_t volatile cWaiters; 1050 /** The mutex semaphore used to protect the event semaphore. */ 1051 __LIBC_PSAFESEMMTX pmtx; 1052 /** Set if the semaphore is shared. 1053 * If shared this structure is allocated from SPM, else it's from the heap. */ 1054 unsigned fShared; 1055 } __LIBC_SAFESEMEV; 1056 /** Pointer to a SAFESEM Event structure. */ 1057 typedef __LIBC_SAFESEMEV *__LIBC_PSAFESEMEV; 1014 1058 1015 1059 /** … … 1018 1062 * @returns 0 on success. 1019 1063 * @returns Negative error code (errno.h) on failure. 1020 * @param phev Where to store the semaphore handle. 1064 * @param pev Pointer to the semaphore structure to initialize. 1065 * @param pmtx Pointer to the mutex semaphore which protects the event semaphore. 1021 1066 * @param fShared Set if the semaphore should be sharable between processes. 1022 1067 */ 1023 int __libc_Back_safesemEvCreate( uintptr_t *phev, int fShared);1068 int __libc_Back_safesemEvCreate(__LIBC_PSAFESEMEV pev, __LIBC_PSAFESEMMTX pmtx, int fShared); 1024 1069 1025 1070 /** 1026 1071 * Opens a shared safe event sem. 1027 1072 * 1028 * @returns 0 on success. 1029 * @returns Negative error code (errno.h) on failure. 1030 * @param hev The semaphore handle. 1031 */ 1032 int __libc_Back_safesemEvOpen(uintptr_t hev); 1073 * The caller is responsible for opening the associated mutex 1074 * semaphore before calling this function. 1075 * 1076 * @returns 0 on success. 1077 * @returns Negative error code (errno.h) on failure. 1078 * @param pev Pointer to the semaphore structure to open. 1079 */ 1080 int __libc_Back_safesemEvOpen(__LIBC_PSAFESEMEV pev); 1033 1081 1034 1082 /** … … 1037 1085 * @returns 0 on success. 1038 1086 * @returns Negative error code (errno.h) on failure. 1039 * @param hev The semaphore handle.1040 */ 1041 int __libc_Back_safesemEvClose( uintptr_t hev);1087 * @param pev Pointer to the semaphore structure to close. 1088 */ 1089 int __libc_Back_safesemEvClose(__LIBC_PSAFESEMEV pev); 1042 1090 1043 1091 /** 1044 1092 * Sleep on a semaphore. 1045 1093 * 1046 * This is the most difficult thing we're doing in this file. 1047 * 1048 * @returns 0 on success. 1049 * @returns Negative error code (errno.h) on failure. 1050 * 1051 * @param hev The semaphore to sleep on. 1052 * @param hmtx The semaphore protecting hev and which is to be unlocked while 1053 * sleeping and reaquired upon waking up. 1054 * @param pfnComplete Function to execute on signal and on wait completion. 1094 * The caller must own the associated mutex semaphore. The mutex semaphore will 1095 * be released as we go to sleep and reclaimed when we wake up. 1096 * 1097 * The pfnComplete callback is used to correct state before signals are handled. 1098 * It will always be called be for this function returns, and it'll either be under 1099 * the protection of the signal mutex or the associated mutex (both safe sems). 1100 * 1101 * This is the most difficult thing we're doing in this API. On OS/2 we have 1102 * potential (at least theoretically) race conditions... 1103 * 1104 * @returns 0 on success. 1105 * @returns Negative error code (errno.h) on failure. 1106 * 1107 * @param pev Pointer to the semaphore structure to sleep on. 1108 * @param pfnComplete Function to execute on signal or on wait completion. 1055 1109 * @param pvUser User argument to pfnComplete. 1056 1110 */ 1057 int __libc_Back_safesemEvSleep( uintptr_t hev, uintptr_t hmtx, void (*pfnComplete)(void *pvUser), void *pvUser);1111 int __libc_Back_safesemEvSleep(__LIBC_PSAFESEMEV pev, void (*pfnComplete)(void *pvUser), void *pvUser); 1058 1112 1059 1113 /** … … 1062 1116 * @returns 0 on success. 1063 1117 * @returns Negative error code (errno.h) on failure. 1064 * @param hev Event semaphore to post. 1065 * @param hmtx The semaphore protecting hev (see __libc_Back_safesemEvSleep). 1066 * The caller should own this semaphore, it's purpose is debug strictness only! 1067 */ 1068 int __libc_Back_safesemEvWakeup(uintptr_t hev, uintptr_t hmtx); 1118 * @param pev Pointer to the semaphore structure to post. 1119 */ 1120 int __libc_Back_safesemEvWakeup(__LIBC_PSAFESEMEV pev); 1069 1121 1070 1122 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.