VirtualBox

Changeset 88810 in vbox


Ignore:
Timestamp:
May 1, 2021 1:05:17 AM (4 years ago)
Author:
vboxsync
Message:

IPRT/RTReqPool: Added RTREQPOOLCFGVAR_THREAD_FLAGS so we can supply RTTHREADFLAGS_COM_MTA or similar to RTThreadCreate for the pool. bugref:9890

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/req.h

    r82968 r88810  
    332332    /** The desired RTTHREADTYPE of the worker threads. */
    333333    RTREQPOOLCFGVAR_THREAD_TYPE,
     334    /** The RTTHREADFLAGS mask for the worker threads (not waitable). */
     335    RTREQPOOLCFGVAR_THREAD_FLAGS,
    334336    /** The minimum number of threads to keep handy once spawned. */
    335337    RTREQPOOLCFGVAR_MIN_THREADS,
  • trunk/src/VBox/Runtime/common/misc/reqpool.cpp

    r82968 r88810  
    116116    /** The worker thread type. */
    117117    RTTHREADTYPE            enmThreadType;
     118    /** The work thread flags (RTTHREADFLAGS). */
     119    uint32_t                fThreadFlags;
    118120    /** The maximum number of worker threads. */
    119121    uint32_t                cMaxThreads;
     
    463465
    464466    int rc = RTThreadCreateF(&pThread->hThread, rtReqPoolThreadProc, pThread, 0 /*default stack size*/,
    465                              pPool->enmThreadType, 0 /*fFlags*/, "%s%02u", pPool->szName, pPool->cThreadsCreated);
     467                             pPool->enmThreadType, pPool->fThreadFlags, "%s%02u", pPool->szName, pPool->cThreadsCreated);
    466468    if (RT_SUCCESS(rc))
    467469        pPool->uLastThreadCreateNanoTs = pThread->uBirthNanoTs;
     
    658660        return VERR_NO_MEMORY;
    659661
    660     pPool->u32Magic         = RTREQPOOL_MAGIC;
     662    pPool->u32Magic             = RTREQPOOL_MAGIC;
    661663    RTStrCopy(pPool->szName, sizeof(pPool->szName), pszName);
    662664
    663665    pPool->enmThreadType        = RTTHREADTYPE_DEFAULT;
     666    pPool->fThreadFlags         = 0;
    664667    pPool->cMaxThreads          = cMaxThreads;
    665668    pPool->cMinThreads          = cMinThreads;
     
    731734            break;
    732735
     736        case RTREQPOOLCFGVAR_THREAD_FLAGS:
     737            AssertMsgBreakStmt(!(uValue & ~(uint64_t)RTTHREADFLAGS_MASK) && !(uValue & RTTHREADFLAGS_WAITABLE),
     738                               ("%#llx\n",  uValue), rc = VERR_INVALID_FLAGS);
     739
     740            pPool->fThreadFlags = (uint32_t)uValue;
     741            break;
     742
    733743        case RTREQPOOLCFGVAR_MIN_THREADS:
    734744            AssertMsgBreakStmt(uValue <= RTREQPOOL_MAX_THREADS,  ("%llu\n",  uValue), rc = VERR_OUT_OF_RANGE);
     
    881891            break;
    882892
     893        case RTREQPOOLCFGVAR_THREAD_FLAGS:
     894            u64 = pPool->fThreadFlags;
     895            break;
     896
    883897        case RTREQPOOLCFGVAR_MIN_THREADS:
    884898            u64 = pPool->cMinThreads;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette