- Timestamp:
- Mar 5, 2014 6:48:59 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/winphone/pjlib/src/pj/os_core_win32.c
r4618 r4777 39 39 #endif 40 40 41 #if PJ_WIN32_WINPHONE42 # include "../../ third_party/threademulation/include/ThreadEmulation.h"41 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 42 # include "../../../third_party/threademulation/include/ThreadEmulation.h" 43 43 #endif 44 44 … … 306 306 PJ_DEF(int) pj_thread_get_prio(pj_thread_t *thread) 307 307 { 308 #if PJ_WIN32_WINPHONE308 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 309 309 PJ_UNUSED_ARG(thread); 310 310 return -1; … … 326 326 PJ_EINVAL); 327 327 328 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 329 if (SetThreadPriorityRT(thread->hthread, prio) == FALSE) 330 #else 328 331 if (SetThreadPriority(thread->hthread, prio) == FALSE) 332 #endif 329 333 return PJ_RETURN_OS_ERROR(GetLastError()); 330 334 … … 487 491 pj_thread_t *rec; 488 492 493 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 494 PJ_UNUSED_ARG(stack_size); 495 #endif 496 489 497 PJ_CHECK_STACK(); 490 498 PJ_ASSERT_RETURN(pool && proc && thread_ptr, PJ_EINVAL); … … 521 529 rec->arg = arg; 522 530 523 #if defPJ_WIN32_WINPHONE524 rec->hthread = CreateThread (NULL, stack_size,525 thread_main, rec,526 dwflags, NULL);531 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 532 rec->hthread = CreateThreadRT(NULL, 0, 533 thread_main, rec, 534 dwflags, NULL); 527 535 #else 528 536 rec->hthread = CreateThread(NULL, stack_size, … … 562 570 PJ_ASSERT_RETURN(p, PJ_EINVAL); 563 571 572 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 573 if (ResumeThreadRT(rec->hthread) == (DWORD)-1) 574 #else 564 575 if (ResumeThread(rec->hthread) == (DWORD)-1) 576 #endif 565 577 return PJ_RETURN_OS_ERROR(GetLastError()); 566 578 else … … 606 618 PJ_LOG(6, (pj_thread_this()->obj_name, "Joining thread %s", p->obj_name)); 607 619 608 #if PJ_WIN32_WINPHONE620 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 609 621 rc = WaitForSingleObjectEx(rec->hthread, INFINITE, FALSE); 610 622 #else … … 642 654 { 643 655 PJ_CHECK_STACK(); 656 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 657 SleepRT(msec); 658 #else 644 659 Sleep(msec); 660 #endif 645 661 return PJ_SUCCESS; 646 662 } … … 836 852 //PJ_CHECK_STACK(); 837 853 854 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 855 *index = TlsAllocRT(); 856 #else 838 857 *index = TlsAlloc(); 858 #endif 839 859 840 860 if (*index == TLS_OUT_OF_INDEXES) … … 850 870 { 851 871 PJ_CHECK_STACK(); 872 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 873 TlsFreeRT(index); 874 #else 852 875 TlsFree(index); 876 #endif 853 877 } 854 878 … … 863 887 //beginning before main thread is initialized. 864 888 //PJ_CHECK_STACK(); 889 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 890 rc = TlsSetValueRT(index, value); 891 #else 865 892 rc = TlsSetValue(index, value); 893 #endif 866 894 return rc!=0 ? PJ_SUCCESS : PJ_RETURN_OS_ERROR(GetLastError()); 867 895 } … … 875 903 //by PJ_CHECK_STACK() itself!!! 876 904 //PJ_CHECK_STACK(); 905 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 906 return TlsGetValueRT(index); 907 #else 877 908 return TlsGetValue(index); 909 #endif 878 910 } 879 911 … … 884 916 PJ_CHECK_STACK(); 885 917 886 #if PJ_WIN32_WINPHONE918 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 887 919 InitializeCriticalSectionEx(&mutex->crit, 0, 0); 888 920 #elif PJ_WIN32_WINNT >= 0x0400 … … 1140 1172 1141 1173 sem = pj_pool_alloc(pool, sizeof(*sem)); 1142 #if PJ_WIN32_WINPHONE1174 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 1143 1175 /** SEMAPHORE_ALL_ACCESS **/ 1144 1176 sem->hSemaphore = CreateSemaphoreEx(NULL, initial, max, NULL, 0, … … 1177 1209 pj_thread_this()->obj_name)); 1178 1210 1179 #if PJ_WIN32_WINPHONE1211 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 1180 1212 result = WaitForSingleObjectEx(sem->hSemaphore, timeout, FALSE); 1181 1213 #else … … 1279 1311 return PJ_ENOMEM; 1280 1312 1281 #if PJ_WIN32_WINPHONE1313 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 1282 1314 event->hEvent = CreateEventEx(NULL, NULL, 1283 1315 (manual_reset?0x1:0x0)|(initial?0x2:0x0), … … 1318 1350 pj_thread_this()->obj_name)); 1319 1351 1320 #if PJ_WIN32_WINPHONE1352 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 1321 1353 result = WaitForSingleObjectEx(event->hEvent, timeout, FALSE); 1322 1354 #else … … 1380 1412 PJ_DEF(pj_status_t) pj_event_pulse(pj_event_t *event) 1381 1413 { 1382 #if defPJ_WIN32_WINPHONE1414 #if defined(PJ_WIN32_WINPHONE) && PJ_WIN32_WINPHONE 1383 1415 PJ_UNUSED_ARG(event); 1384 1416 pj_assert(!"pj_event_pulse() not supported!");
Note: See TracChangeset
for help on using the changeset viewer.