Changeset 2217 for pjproject/trunk/pjlib/src/pjlib-test/mutex.c
- Timestamp:
- Aug 15, 2008 2:53:18 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pjlib-test/mutex.c
r2039 r2217 149 149 } 150 150 151 #if PJ_HAS_SEMAPHORE 152 static int semaphore_test(pj_pool_t *pool) 153 { 154 pj_sem_t *sem; 155 pj_status_t status; 156 157 PJ_LOG(3,("", "...testing semaphore")); 158 159 status = pj_sem_create(pool, NULL, 0, 1, &sem); 160 if (status != PJ_SUCCESS) { 161 app_perror("...error: pj_sem_create()", status); 162 return -151; 163 } 164 165 status = pj_sem_post(sem); 166 if (status != PJ_SUCCESS) { 167 app_perror("...error: pj_sem_post()", status); 168 pj_sem_destroy(sem); 169 return -153; 170 } 171 172 status = pj_sem_trywait(sem); 173 if (status != PJ_SUCCESS) { 174 app_perror("...error: pj_sem_trywait()", status); 175 pj_sem_destroy(sem); 176 return -156; 177 } 178 179 status = pj_sem_post(sem); 180 if (status != PJ_SUCCESS) { 181 app_perror("...error: pj_sem_post()", status); 182 pj_sem_destroy(sem); 183 return -159; 184 } 185 186 status = pj_sem_wait(sem); 187 if (status != PJ_SUCCESS) { 188 app_perror("...error: pj_sem_wait()", status); 189 pj_sem_destroy(sem); 190 return -161; 191 } 192 193 status = pj_sem_destroy(sem); 194 if (status != PJ_SUCCESS) { 195 app_perror("...error: pj_sem_destroy()", status); 196 return -163; 197 } 198 199 return 0; 200 } 201 #endif /* PJ_HAS_SEMAPHORE */ 202 203 151 204 int mutex_test(void) 152 205 { … … 164 217 return rc; 165 218 219 #if PJ_HAS_SEMAPHORE 220 rc = semaphore_test(pool); 221 if (rc != 0) 222 return rc; 223 #endif 224 166 225 pj_pool_release(pool); 167 226
Note: See TracChangeset
for help on using the changeset viewer.