Changeset 11598 in vbox for trunk/src/libs
- Timestamp:
- Aug 23, 2008 11:39:13 PM (16 years ago)
- Location:
- trunk/src/libs/xpcom18a4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/Makefile.kmk
r11595 r11598 78 78 TEMPLATE_XPCOM_DEFS = MOZILLA_CLIENT=1 NDEBUG=1 _IMPL_NS_COM \ 79 79 XPCOM_DLL_BASE=\"$(basename $(notdir $(LIB_XPCOM)))\" \ 80 MOZ_DLL_SUFFIX=\"$(suffix $(LIB_XPCOM))\" 80 MOZ_DLL_SUFFIX=\"$(suffix $(LIB_XPCOM))\" \ 81 IN_RING3 81 82 ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP 82 83 TEMPLATE_XPCOM_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP … … 667 668 HAVE_STRERROR=1 \ 668 669 FORCE_PR_LOG 670 VBox-xpcom-nspr_DEFS += \ 671 VBOX_USE_IPRT_IN_NSPR 669 672 VBox-xpcom-nspr_DEFS.darwin = \ 670 673 HAVE_BSD_FLOCK=1 \ … … 1193 1196 1194 1197 ifdef IPC_LOGGING 1195 TEMPLATE_XPCOMIPC_DEFS += I N_RING3 IPC_LOGGING1198 TEMPLATE_XPCOMIPC_DEFS += IPC_LOGGING 1196 1199 TEMPLATE_XPCOMIPC_LIBS = $(TEMPLATE_XPCOM_LIBS) $(LIB_RUNTIME) 1197 1200 endif … … 1203 1206 TEMPLATE_XPCOMIPCEXE_DEFS = $(TEMPLATE_XPCOMEXE_DEFS) BUILD_DCONNECT="1" 1204 1207 ifdef IPC_LOGGING 1205 TEMPLATE_XPCOMIPCEXE_DEFS += I N_RING3 IPC_LOGGING1208 TEMPLATE_XPCOMIPCEXE_DEFS += IPC_LOGGING 1206 1209 TEMPLATE_XPCOMIPCEXE_LIBS = $(TEMPLATE_XPCOMEXE_LIBS) $(LIB_RUNTIME) 1207 1210 endif -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c
r5058 r11598 39 39 #include <ctype.h> 40 40 #include <string.h> 41 #ifdef VBOX_USE_IPRT_IN_NSPR 42 # include <iprt/initterm.h> 43 #endif 41 44 42 45 PRLogModuleInfo *_pr_clock_lm; … … 173 176 if (_pr_initialized) return; 174 177 _pr_initialized = PR_TRUE; 178 #ifdef VBOX_USE_IPRT_IN_NSPR 179 RTR3Init(false /* fInitSUPLib */, 0 /* cbReserve */); 180 #endif 175 181 #ifdef _PR_ZONE_ALLOCATOR 176 182 _PR_InitZones(); -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptthread.c
r1 r11598 53 53 #include <signal.h> 54 54 55 #ifdef VBOX_USE_IPRT_IN_NSPR 56 # include <iprt/thread.h> 57 # include <iprt/mem.h> 58 # include <iprt/asm.h> 59 # include <iprt/err.h> 60 #endif /* VBOX_USE_IPRT_IN_NSPR */ 61 55 62 /* 56 63 * Record whether or not we have the privilege to set the scheduling … … 258 265 } /* _pt_root */ 259 266 267 #ifdef VBOX_USE_IPRT_IN_NSPR 268 static DECLCALLBACK(int) _pt_iprt_root( 269 RTTHREAD Thread, void *pvUser) 270 { 271 PRThread *thred = (PRThread *)pvUser; 272 _pt_root(thred); 273 return VINF_SUCCESS; 274 } 275 #endif /* VBOX_USE_IPRT_IN_NSPR */ 276 260 277 static PRThread* pt_AttachThread(void) 261 278 { … … 305 322 int rv; 306 323 PRThread *thred; 324 #ifndef VBOX_USE_IPRT_IN_NSPR 307 325 pthread_attr_t tattr; 326 #else 327 static uint32_t volatile s_iThread = 0; 328 RTTHREADTYPE enmType; 329 RTTHREAD hThread; 330 uint32_t fFlags = 0; 331 #endif 308 332 309 333 if (!_pr_initialized) _PR_ImplicitInitialization(); … … 314 338 priority = PR_PRIORITY_LAST; 315 339 340 #ifndef VBOX_USE_IPRT_IN_NSPR 316 341 rv = _PT_PTHREAD_ATTR_INIT(&tattr); 317 342 PR_ASSERT(0 == rv); … … 345 370 #endif /* !defined(_PR_DCETHREADS) */ 346 371 } 347 372 #else /* VBOX_USE_IPRT_IN_NSPR */ 373 /* calc priority */ 374 switch (priority) 375 { 376 default: 377 case PR_PRIORITY_NORMAL: enmType = RTTHREADTYPE_DEFAULT; break; 378 case PR_PRIORITY_LOW: enmType = RTTHREADTYPE_MAIN_HEAVY_WORKER; break; 379 case PR_PRIORITY_HIGH: enmType = RTTHREADTYPE_MAIN_WORKER; break; 380 case PR_PRIORITY_URGENT: enmType = RTTHREADTYPE_IO; break; 381 } 382 #endif /* VBOX_USE_IPRT_IN_NSPR */ 383 384 #ifndef VBOX_USE_IPRT_IN_NSPR 348 385 /* 349 386 * DCE threads can't set detach state before creating the thread. … … 356 393 PR_ASSERT(0 == rv); 357 394 #endif /* !defined(_PR_DCETHREADS) */ 395 #else 396 if (state == PR_JOINABLE_THREAD) 397 fFlags |= RTTHREADFLAGS_WAITABLE; 398 #endif /* !VBOX_USE_IPRT_IN_NSPR */ 358 399 359 400 if (0 == stackSize) stackSize = (64 * 1024); /* default == 64K */ … … 361 402 if (stackSize < _MD_MINIMUM_STACK_SIZE) stackSize = _MD_MINIMUM_STACK_SIZE; 362 403 #endif 404 #ifndef VBOX_USE_IPRT_IN_NSPR 363 405 /* 364 406 * Linux doesn't have pthread_attr_setstacksize. … … 368 410 PR_ASSERT(0 == rv); 369 411 #endif 412 #endif /* !VBOX_USE_IPRT_IN_NSPR */ 370 413 371 414 thred = PR_NEWZAP(PRThread); … … 388 431 scope = PR_GLOBAL_THREAD; 389 432 433 #ifndef VBOX_USE_IPRT_IN_NSPR 390 434 if (PR_GLOBAL_BOUND_THREAD == scope) { 391 435 #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) … … 404 448 #endif 405 449 } 450 #endif /* !VBOX_USE_IPRT_IN_NSPR */ 406 451 if (PR_GLOBAL_THREAD == scope) 407 452 thred->state |= PT_THREAD_GLOBAL; … … 443 488 * pthread_create() may be doing to its argument. 444 489 */ 490 #ifndef VBOX_USE_IPRT_IN_NSPR 445 491 rv = _PT_PTHREAD_CREATE(&id, tattr, _pt_root, thred); 446 492 … … 472 518 } 473 519 #endif 520 #else /* VBOX_USE_IPRT_IN_NSPR */ 521 rv = RTThreadCreateF(&hThread, _pt_iprt_root, thred, stackSize, enmType, fFlags, "nspr-%u", ASMAtomicIncU32(&s_iThread)); 522 if (RT_SUCCESS(rv)) { 523 id = (pthread_t)RTThreadGetNative(hThread); 524 rv = 0; 525 } 526 #endif /* VBOX_USE_IPRT_IN_NSPR */ 474 527 475 528 if (0 != rv) … … 515 568 516 569 done: 570 #ifndef VBOX_USE_IPRT_IN_NSPR 517 571 rv = _PT_PTHREAD_ATTR_DESTROY(&tattr); 518 572 PR_ASSERT(0 == rv); 573 #endif 519 574 520 575 return thred; … … 578 633 else 579 634 { 635 #ifndef VBOX_USE_IPRT_IN_NSPR 580 636 pthread_t id = thred->id; 581 637 rv = pthread_join(id, &result); … … 607 663 PR_SetError(prerror, rv); 608 664 } 665 #else /* VBOX_USE_IPRT_IN_NSPR */ 666 rv = VERR_INVALID_HANDLE; 667 RTTHREAD hThread = RTThreadFromNative((RTNATIVETHREAD)thred->id); 668 if (hThread != NIL_RTTHREAD) 669 { 670 int rcThread = 0; 671 rv = RTThreadWait(hThread, RT_INDEFINITE_WAIT, &rcThread); 672 PR_ASSERT(RT_SUCCESS(rv) && rcThread == VINF_SUCCESS); 673 if (RT_SUCCESS(rv)) 674 { 675 rv = 0; 676 _pt_thread_death(thred); 677 } 678 else 679 PR_SetError(rv == VERR_THREAD_NOT_WAITABLE 680 ? PR_INVALID_ARGUMENT_ERROR 681 : PR_UNKNOWN_ERROR, 682 rv); 683 } 684 #endif /* VBOX_USE_IPRT_IN_NSPR */ 609 685 } 610 686 return (0 == rv) ? PR_SUCCESS : PR_FAILURE;
Note:
See TracChangeset
for help on using the changeset viewer.