- Timestamp:
- Oct 16, 2013 8:04:59 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/winphone/pjlib/src/pj/os_core_win32.c
r4537 r4618 39 39 #endif 40 40 41 #if PJ_WIN32_WINPHONE 42 # include "../../third_party/threademulation/include/ThreadEmulation.h" 43 #endif 44 45 #if PJ_WIN32_WINNT >= 0x0602 46 # include <synchapi.h> 47 #endif 48 41 49 /* Activate mutex related logging if PJ_DEBUG_MUTEX is set, otherwise 42 50 * use default level 6 logging. … … 298 306 PJ_DEF(int) pj_thread_get_prio(pj_thread_t *thread) 299 307 { 308 #if PJ_WIN32_WINPHONE 309 PJ_UNUSED_ARG(thread); 310 return -1; 311 #else 300 312 return GetThreadPriority(thread->hthread); 313 #endif 301 314 } 302 315 … … 507 520 rec->proc = proc; 508 521 rec->arg = arg; 522 523 #ifdef PJ_WIN32_WINPHONE 524 rec->hthread = CreateThread(NULL, stack_size, 525 thread_main, rec, 526 dwflags, NULL); 527 #else 509 528 rec->hthread = CreateThread(NULL, stack_size, 510 529 thread_main, rec, 511 530 dwflags, &rec->idthread); 531 #endif 532 512 533 if (rec->hthread == NULL) 513 534 return PJ_RETURN_OS_ERROR(GetLastError()); … … 552 573 PJ_DEF(pj_thread_t*) pj_thread_this(void) 553 574 { 554 pj_thread_t *rec = pj_thread_local_get(thread_tls_id);575 pj_thread_t *rec = (pj_thread_t *)pj_thread_local_get(thread_tls_id); 555 576 556 577 if (rec == NULL) { … … 585 606 PJ_LOG(6, (pj_thread_this()->obj_name, "Joining thread %s", p->obj_name)); 586 607 608 #if PJ_WIN32_WINPHONE 609 rc = WaitForSingleObjectEx(rec->hthread, INFINITE, FALSE); 610 #else 587 611 rc = WaitForSingleObject(rec->hthread, INFINITE); 612 #endif 588 613 589 614 if (rc==WAIT_OBJECT_0) … … 859 884 PJ_CHECK_STACK(); 860 885 861 #if PJ_WIN32_WINNT >= 0x0400 862 InitializeCriticalSection(&mutex->crit); 886 #if PJ_WIN32_WINPHONE 887 InitializeCriticalSectionEx(&mutex->crit, 0, 0); 888 #elif PJ_WIN32_WINNT >= 0x0400 889 InitializeCriticalSection(&mutex->crit); 863 890 #else 864 891 mutex->hMutex = CreateMutex(NULL, FALSE, NULL); … … 1112 1139 PJ_ASSERT_RETURN(pool && sem_ptr, PJ_EINVAL); 1113 1140 1114 sem = pj_pool_alloc(pool, sizeof(*sem)); 1141 sem = pj_pool_alloc(pool, sizeof(*sem)); 1142 #if PJ_WIN32_WINPHONE 1143 /** SEMAPHORE_ALL_ACCESS **/ 1144 sem->hSemaphore = CreateSemaphoreEx(NULL, initial, max, NULL, 0, 1145 SEMAPHORE_ALL_ACCESS); 1146 #else 1115 1147 sem->hSemaphore = CreateSemaphore(NULL, initial, max, NULL); 1148 #endif 1116 1149 if (!sem->hSemaphore) 1117 1150 return PJ_RETURN_OS_ERROR(GetLastError()); … … 1144 1177 pj_thread_this()->obj_name)); 1145 1178 1179 #if PJ_WIN32_WINPHONE 1180 result = WaitForSingleObjectEx(sem->hSemaphore, timeout, FALSE); 1181 #else 1146 1182 result = WaitForSingleObject(sem->hSemaphore, timeout); 1183 #endif 1184 1147 1185 if (result == WAIT_OBJECT_0) { 1148 1186 LOG_MUTEX((sem->obj_name, "Semaphore acquired by thread %s", … … 1241 1279 return PJ_ENOMEM; 1242 1280 1281 #if PJ_WIN32_WINPHONE 1282 event->hEvent = CreateEventEx(NULL, NULL, 1283 (manual_reset?0x1:0x0)|(initial?0x2:0x0), 1284 EVENT_ALL_ACCESS); 1285 #else 1243 1286 event->hEvent = CreateEvent(NULL, manual_reset?TRUE:FALSE, 1244 1287 initial?TRUE:FALSE, NULL); 1288 #endif 1245 1289 1246 1290 if (!event->hEvent) … … 1274 1318 pj_thread_this()->obj_name)); 1275 1319 1320 #if PJ_WIN32_WINPHONE 1321 result = WaitForSingleObjectEx(event->hEvent, timeout, FALSE); 1322 #else 1276 1323 result = WaitForSingleObject(event->hEvent, timeout); 1324 #endif 1277 1325 if (result == WAIT_OBJECT_0) { 1278 1326 PJ_LOG(6, (event->obj_name, "Event: thread %s is released", … … 1332 1380 PJ_DEF(pj_status_t) pj_event_pulse(pj_event_t *event) 1333 1381 { 1382 #ifdef PJ_WIN32_WINPHONE 1383 PJ_UNUSED_ARG(event); 1384 pj_assert(!"pj_event_pulse() not supported!"); 1385 return PJ_ENOTSUP; 1386 #else 1334 1387 PJ_CHECK_STACK(); 1335 1388 PJ_ASSERT_RETURN(event, PJ_EINVAL); … … 1341 1394 else 1342 1395 return PJ_RETURN_OS_ERROR(GetLastError()); 1396 #endif 1343 1397 } 1344 1398
Note: See TracChangeset
for help on using the changeset viewer.