Changeset 39635 in vbox for trunk/src/libs/xpcom18a4/ipc/ipcd
- Timestamp:
- Dec 16, 2011 12:02:38 AM (13 years ago)
- Location:
- trunk/src/libs/xpcom18a4/ipc/ipcd
- Files:
-
- 4 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp
r39532 r39635 53 53 54 54 #ifdef VBOX 55 #include <map> 56 #include <list> 55 # include <map> 56 # include <list> 57 # include <iprt/err.h> 58 # include <iprt/req.h> 59 # include <iprt/mem.h> 57 60 #endif /* VBOX */ 58 61 59 #if defined(DCONNECT_MULTITHREADED) 62 #if defined(DCONNECT_MULTITHREADED) && !defined(DCONNECT_WITH_IPRT_REQ_POOL) 60 63 61 64 #include "nsIThread.h" … … 2869 2872 //----------------------------------------------------------------------------- 2870 2873 2871 #if defined(DCONNECT_MULTITHREADED) 2874 #if defined(DCONNECT_MULTITHREADED) && !defined(DCONNECT_WITH_IPRT_REQ_POOL) 2872 2875 2873 2876 class DConnectWorker : public nsIRunnable … … 2977 2980 } 2978 2981 2979 #endif // defined(DCONNECT_MULTITHREADED) 2982 #endif // defined(DCONNECT_MULTITHREADED) && !defined(DCONNECT_WITH_IPRT_REQ_POOL) 2980 2983 2981 2984 //----------------------------------------------------------------------------- … … 2986 2989 , mDisconnected(PR_TRUE) 2987 2990 , mStubQILock(NULL) 2991 #if defined(DCONNECT_WITH_IPRT_REQ_POOL) 2992 , mhReqPool(NIL_RTREQPOOL) 2993 #endif 2988 2994 { 2989 2995 } … … 3018 3024 PR_DestroyLock(mStubLock); 3019 3025 PR_DestroyLock(mLock); 3026 #if defined(DCONNECT_WITH_IPRT_REQ_POOL) 3027 RTReqPoolRelease(mhReqPool); 3028 mhReqPool = NIL_RTREQPOOL; 3029 #endif 3020 3030 } 3021 3031 … … 3062 3072 3063 3073 #if defined(DCONNECT_MULTITHREADED) 3074 # if defined(DCONNECT_WITH_IPRT_REQ_POOL) 3075 int vrc = RTReqPoolCreate(1024 /*cMaxThreads*/, 10*RT_MS_1SEC /*cMsMinIdle*/, 3076 8 /*cThreadsPushBackThreshold */, RT_MS_1SEC /* cMsMaxPushBack */, 3077 "dconnect", &mhReqPool); 3078 if (RT_FAILURE(vrc)) 3079 { 3080 mhReqPool = NIL_RTREQPOOL; 3081 return NS_ERROR_FAILURE; 3082 } 3083 3084 /// @todo check where this is used. 3085 mDisconnected = PR_FALSE; 3086 3087 # else 3064 3088 3065 3089 mPendingMon = nsAutoMonitor::NewMonitor("DConnect pendingQ monitor"); … … 3086 3110 } 3087 3111 3112 # endif 3088 3113 #else 3089 3114 … … 3109 3134 3110 3135 #if defined(DCONNECT_MULTITHREADED) 3136 # if defined(DCONNECT_WITH_IPRT_REQ_POOL) 3137 3138 # if defined(DCONNECT_STATS) 3139 /// @todo print pool stats. 3140 # endif 3141 3142 RTReqPoolRelease(mhReqPool); 3143 mhReqPool = NIL_RTREQPOOL; 3144 3145 # else 3111 3146 3112 3147 { … … 3138 3173 nsAutoMonitor::DestroyMonitor(mPendingMon); 3139 3174 3175 # endif 3140 3176 #endif 3141 3177 … … 3410 3446 3411 3447 #if defined(DCONNECT_MULTITHREADED) 3448 # if defined(DCONNECT_WITH_IPRT_REQ_POOL) 3449 3450 void *pvDataDup = RTMemDup(aData, aDataLen); 3451 if (RT_UNLIKELY(!pvDataDup)) 3452 return NS_ERROR_OUT_OF_MEMORY; 3453 int rc = RTReqPoolCallVoidNoWait(mhReqPool, (PFNRT)ProcessMessageOnWorkerThread, 4, 3454 this, aSenderID, pvDataDup, aDataLen); 3455 if (RT_FAILURE(rc)) 3456 return NS_ERROR_FAILURE; 3457 3458 # else 3412 3459 3413 3460 nsAutoMonitor mon(mPendingMon); … … 3441 3488 } 3442 3489 3490 # endif 3443 3491 #else 3444 3492 … … 3543 3591 3544 3592 //----------------------------------------------------------------------------- 3593 3594 #if defined(DCONNECT_WITH_IPRT_REQ_POOL) 3595 /** 3596 * Function called by the request thread pool to process a incoming request in 3597 * the context of a worker thread. 3598 */ 3599 /* static */ DECLCALLBACK(void) 3600 ipcDConnectService::ProcessMessageOnWorkerThread(ipcDConnectService *aThis, PRUint32 aSenderID, void *aData, PRUint32 aDataLen) 3601 { 3602 if (!aThis->mDisconnected) 3603 aThis->OnIncomingRequest(aSenderID, (const DConnectOp *)aData, aDataLen); 3604 RTMemFree(aData); 3605 } 3606 #endif 3545 3607 3546 3608 void -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.h
r39341 r39635 40 40 #if !defined(DCONNECT_SINGLETHREADED) && !defined(DCONNECT_MULTITHREADED) 41 41 #define DCONNECT_MULTITHREADED 42 # ifdef VBOX 43 //# define DCONNECT_WITH_IPRT_REQ_POOL - needs testing 44 # endif 42 45 #endif 43 46 … … 59 62 60 63 #if defined(DCONNECT_MULTITHREADED) 64 # if defined(DCONNECT_WITH_IPRT_REQ_POOL) 65 66 # include <iprt/req.h> 67 68 # else /* !DCONNECT_WITH_IPRT_REQ_POOL*/ 61 69 62 70 #include "ipcList.h" … … 80 88 }; 81 89 90 # endif // !DCONNECT_WITH_IPRT_REQ_POOL 82 91 #endif // DCONNECT_MULTITHREADED 83 92 … … 275 284 276 285 #if defined(DCONNECT_MULTITHREADED) 286 # if defined(DCONNECT_WITH_IPRT_REQ_POOL) 287 static DECLCALLBACK(void) ProcessMessageOnWorkerThread(ipcDConnectService *aThis, PRUint32 aSenderID, void *aData, PRUint32 aDataLen); 288 # else 277 289 NS_HIDDEN_(nsresult) CreateWorker(); 290 # endif 278 291 #endif 279 292 … … 310 323 311 324 #if defined(DCONNECT_MULTITHREADED) 325 # if defined(DCONNECT_WITH_IPRT_REQ_POOL) 326 327 /** Request pool. */ 328 RTREQPOOL mhReqPool; 329 330 # else 312 331 313 332 friend class DConnectWorker; … … 323 342 // monitor used to wait on changes in mWaitingWorkers. 324 343 PRMonitor *mWaitingWorkersMon; 325 344 # endif 326 345 #endif 327 346
Note:
See TracChangeset
for help on using the changeset viewer.