亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? rvtimer.c

?? 基于h323協議的軟phone
?? C
?? 第 1 頁 / 共 4 頁
字號:
    maxtimers = RvObjPoolGetMaxitems(&tqueue->pool);
    RvLockRelease(&tqueue->lock);

    return maxtimers;
}

/* Sets the value for maxtimers (not used by FIXED queues). */
/* Returns RV_TRUE upon success (otherwise RV_FALSE). */
RvBool RvTimerQueueSetMaxtimers(RvTimerQueue *tqueue, RvSize_t maxtimers)
{
    RvBool result;

#if defined(RV_NULLCHECK)
    if(tqueue == NULL)
        return RV_FALSE;
#endif

    if(RvLockGet(&tqueue->lock) != RV_OK)
        return RV_FALSE;
    result = RvObjPoolSetMaxitems(&tqueue->pool, maxtimers);
    RvLockRelease(&tqueue->lock);

    return result;
}

/* Changes the value for maxtimers (not used by FIXED queues) by an */
/* offset (delta). The direction parameter indicates whether the delta */
/* is an increase or a decrease. Returns RV_TRUE upon success */
/* (otherwise RV_FALSE). */
RvBool RvTimerQueueChangeMaxtimers(RvTimerQueue *tqueue, RvSize_t delta, RvBool direction)
{
    RvBool result;
    RvSize_t maxtimers;

#if defined(RV_NULLCHECK)
    if(tqueue == NULL)
        return RV_FALSE;
#endif
#if defined(RV_RANGECHECK)
    if((direction != RV_TIMER_VALUE_INCREASE) && (direction != RV_TIMER_VALUE_DECREASE))
        return RV_FALSE;
#endif

    if(RvLockGet(&tqueue->lock) != RV_OK)
        return RV_FALSE;
    maxtimers = RvObjPoolGetMaxitems(&tqueue->pool);
    if(direction == RV_TIMER_VALUE_DECREASE) {
        if(delta > maxtimers) {
            /* Can't go negative. */
            RvLockRelease(&tqueue->lock);
            return RV_FALSE;
        }
        maxtimers -= delta;
    } else maxtimers += delta;
    result = RvObjPoolSetMaxitems(&tqueue->pool, maxtimers);
    RvLockRelease(&tqueue->lock);

    return result;
}

/* Returns current value for mintimers (not used by FIXED). */
RvSize_t RvTimerQueueGetMintimers(RvTimerQueue *tqueue)
{
    RvSize_t mintimers;

#if defined(RV_NULLCHECK)
    if(tqueue == NULL)
        return 0;
#endif

    if(RvLockGet(&tqueue->lock) != RV_OK)
        return 0;
    mintimers = RvObjPoolGetMinitems(&tqueue->pool);
    RvLockRelease(&tqueue->lock);

    return mintimers;
}

/* Sets the value for mintimers. Returns RV_TRUE upon success */
/* (otherwise RV_FALSE). Note: for FIXED timer queues mintimers */
/* is not normally used and increasing mintimers above the current */
/* timer queue size will increase the memory used by the pool but will */
/* NOT increase the size of the timer queue. Use RvTimerQueueSetSize */
/* to change the size of a FIXED timer queue. */
RvBool RvTimerQueueSetMintimers(RvTimerQueue *tqueue, RvSize_t mintimers)
{
    RvBool result;

#if defined(RV_NULLCHECK)
    if(tqueue == NULL)
        return RV_FALSE;
#endif

    if(RvLockGet(&tqueue->lock) != RV_OK)
        return RV_FALSE;
    result = RvObjPoolSetMinitems(&tqueue->pool, mintimers);
    RvLockRelease(&tqueue->lock);

    return result;
}

/* Changes the value for mintimers by an offset (delta). The */
/* direction parameter indicates whether the delta is an increase */
/* or a decrease. Returns RV_TRUE upon success (otherwise RV_FALSE). */
/* See RvTimerQueueSetMintimers note about increasing FIXED timer queues. */
RvBool RvTimerQueueChangeMintimers(RvTimerQueue *tqueue, RvSize_t delta, RvBool direction)
{
    RvBool result;
    RvSize_t mintimers;

#if defined(RV_NULLCHECK)
    if(tqueue == NULL)
        return RV_FALSE;
#endif
#if defined(RV_RANGECHECK)
    if((direction != RV_TIMER_VALUE_INCREASE) && (direction != RV_TIMER_VALUE_DECREASE))
        return RV_FALSE;
#endif

    if(RvLockGet(&tqueue->lock) != RV_OK)
        return RV_FALSE;
    mintimers = RvObjPoolGetMinitems(&tqueue->pool);
    if(direction == RV_TIMER_VALUE_DECREASE) {
        if(delta > mintimers) {
            /* Can't go negative. */
            RvLockRelease(&tqueue->lock);
            return RV_FALSE;
        }
        mintimers -= delta;
    } else mintimers += delta;
    result = RvObjPoolSetMinitems(&tqueue->pool, mintimers);
    RvLockRelease(&tqueue->lock);

    return result;
}

/* Returns current value for freelevel (only used by DYNAMIC queues) */
RvSize_t RvTimerQueueGetFreelevel(RvTimerQueue *tqueue)
{
    RvSize_t freelevel;

#if defined(RV_NULLCHECK)
    if(tqueue == NULL)
        return 0;
#endif

    if(RvLockGet(&tqueue->lock) != RV_OK)
        return 0;
    freelevel = RvObjPoolGetFreelevel(&tqueue->pool);
    RvLockRelease(&tqueue->lock);

    return freelevel;
}

/* Sets new value for freelevel. Return RV_TRUE if successful (otherwise */
/* return RV_FALSE). Use only by DYNAMIC queues. */
RvBool RvTimerQueueSetFreelevel(RvTimerQueue *tqueue, RvSize_t freelevel)
{
    RvBool result;

#if defined(RV_NULLCHECK)
    if(tqueue == NULL)
        return RV_FALSE;
#endif

    if(RvLockGet(&tqueue->lock) != RV_OK)
        return RV_FALSE;
    result = RvObjPoolSetFreelevel(&tqueue->pool, freelevel);
    RvLockRelease(&tqueue->lock);

    return result;
}

/* Returns number of nanoseconds until next event in nextevent */
/* parameter. Negative number indicates that the event is overdue. */
/* If the queue is empty a warning is returned and nextevent is untouched. */
RVCOREAPI RvStatus RVCALLCONV RvTimerQueueNextEvent(RvTimerQueue *tqueue, RvInt64 *nextevent)
{
    RvStatus result;
    RvInt64 curtime;
    RvTimerEvent *event;

#if defined(RV_NULLCHECK)
    if(tqueue == NULL)
        return RvTimerErrorCode(RV_ERROR_NULLPTR);
#endif

    curtime = RvTimestampGet();

    result = RvLockGet(&tqueue->lock);
    if(result != RV_OK)
        return result;

    event = (RvTimerEvent *)RvPQueuePeek(&tqueue->pqueue);
    if(event != NULL) {
        *nextevent = event->triggertime - curtime;
    } else result = RvTimerErrorCode(RV_TIMER_WARNING_QUEUEEMPTY);

    RvLockRelease(&tqueue->lock);
    return result;
}

/* Destruct a timer queue. This must only be called by a single task */
/* and no calls to any timer function should be in progress. */
RVCOREAPI RvStatus RVCALLCONV RvTimerQueueDestruct(RvTimerQueue *tqueue)
{
    RvStatus result;
    RvTimerEvent *event;

#if defined(RV_NULLCHECK)
    if(tqueue == NULL)
        return RvTimerErrorCode(RV_ERROR_NULLPTR);
#endif

    RvTimerQueueStop(tqueue); /* Doesn't hurt to make sure. */

    result = RvLockGet(&tqueue->lock);
    if(result != RV_OK)
        return result;

    /* Return all events back to pool. */
    for(;;) {
        event = (RvTimerEvent *)RvPQueueGet(&tqueue->pqueue);
        if(event == NULL)
            break;
        RvObjPoolReleaseItem(&tqueue->pool, event);
    }

    RvPQueueDestruct(&tqueue->pqueue);
    if(RvObjPoolDestruct(&tqueue->pool) != RV_TRUE)
        result = RvTimerErrorCode(RV_TIMER_ERROR_POOL);
    RvSemaphoreDestruct(&tqueue->wait);
    RvLockDestruct(&tqueue->lock);

    return result;
}

/* Create individual event for pool. */
static void *RvTimerEventConstruct(void *objptr, void *data)
{
    RvStatus status;
    RvTimerEvent *timerevent;

    timerevent = (RvTimerEvent *)objptr;
    status = RvSemaphoreConstruct(&timerevent->wait, 0);
    if(status != RV_OK)
        return NULL;
    timerevent->waitcount = 0; /* Should always stay in sync with semaphore */
    timerevent->tqueue = (RvTimerQueue *)data; /* Never changes. */
    return objptr;
}

/* Destroy individual event for pool. */
static void RvTimerEventDestruct(void *objptr, void *data)
{
    RV_UNUSED_ARG(data);
    RvSemaphoreDestruct(&((RvTimerEvent *)objptr)->wait);
}

/* Allocate memory page for event pool and Priority Queue. */
static void *RvTimerMemAlloc(RvSize_t size, void *data)
{
    void *result;
    RvStatus status;

    status = RvMemoryAlloc((RvMemory *)data, &result, size);
    if(status != RV_OK)
        return NULL;
    return result;
}

/* Free memory page for event pool and Priority Queue. */
static void RvTimerMemFree(void *ptr, void *data)
{
    RV_UNUSED_ARG(data);
    RvMemoryFree(ptr);
}

/* For Priority queue, return RV_TRUE if ptr1 higher priority than ptr2. */
static RvBool RvTimerPQueueItemCmp(void *ptr1, void *ptr2)
{
    if(((RvTimerEvent *)ptr1)->triggertime < ((RvTimerEvent *)ptr2)->triggertime)
        return RV_TRUE;
    return RV_FALSE;
}

/* For Priority Queue, save index of specified item (used for deletion). */
static void RvTimerPQueueNewIndex(void *item, RvSize_t index)
{
    ((RvTimerEvent *)item)->index = index;
}

/* Add an event to the timer queue specified by tqueue. The timertype is ONESHOT or PERIODIC and */
/* delay specificies the number of nanoseconds to delay before triggering the callback function. */
/* The userdata is simply passed to the callback function. Upon successfull completion of RvTimerStart, */
/* the timer structure will contain an identifier which can be used to cancel that timer. There is */
/* no construct or destruct on the timer structure and it is not required to be maintained for */
/* the event to occur. It is only used for cancelling the timer. If it is NULL, then the timer can */
/* not be cancelled. Note: The minimum time for a timer and the resolution is based on the */
/* timestamp driver and on the rate at which the timer queue is checked. */
RVCOREAPI RvStatus RVCALLCONV RvTimerStart(RvTimer *timer, RvTimerQueue *tqueue, RvInt timertype, RvInt64 delay, RvTimerFunc callback, void *userdata)
{
    RvStatus result;
    RvInt64 starttime;
    RvTimerEvent *event;

#if defined(RV_NULLCHECK)
    if((tqueue == NULL) || (callback == NULL))
        return RvTimerErrorCode(RV_ERROR_NULLPTR);
#endif
#if defined(RV_RANGECHECK)
    if((timertype != RV_TIMER_TYPE_ONESHOT) && (timertype != RV_TIMER_TYPE_PERIODIC))
        return RvTimerErrorCode(RV_ERROR_OUTOFRANGE);
#endif

    /* Get start time as soon as possible for best accuracy. */
    starttime = RvTimestampGet();

    result = RvLockGet(&tqueue->lock);
    if(result != RV_OK)
        return result;

    /* Get a timer event from the pool. */
    event = (RvTimerEvent *)RvObjPoolGetItem(&tqueue->pool);
    if(event == NULL) {
        RvLockRelease(&tqueue->lock);
        return RvTimerErrorCode(RV_TIMER_ERROR_QUEUEFULL);
    }

    /* Initialize event; tqueue, the wait semaphore, and waitcount are already set. */
    event->timertype = timertype;
    event->state = RV_TIMER_EVENTSTATE_QUEUED;
    tqueue->idcounter += RvUintConst(1);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
粉嫩在线一区二区三区视频| 久久99精品视频| 久久婷婷综合激情| 精品91自产拍在线观看一区| 国产女人aaa级久久久级| 最新中文字幕一区二区三区| 亚洲综合成人网| 精品无人码麻豆乱码1区2区 | 91精品国产欧美一区二区18| 欧美成人午夜电影| 亚洲欧美日韩久久| 青椒成人免费视频| av激情综合网| 精品成人免费观看| 在线电影一区二区三区| 欧美亚洲自拍偷拍| 日韩美女视频一区二区| 国产精品99久久久久久久女警| 欧美日韩一区二区三区在线 | 欧美精品乱码久久久久久按摩 | 久久九九久精品国产免费直播| 亚洲影院在线观看| 91蝌蚪porny九色| 亚洲国产高清在线| 国产精品91一区二区| 日韩欧美国产成人一区二区| 视频一区国产视频| 欧美二区在线观看| 天堂成人免费av电影一区| 在线观看一区二区视频| 一区二区三区在线看| 99久久亚洲一区二区三区青草| 国产日韩精品一区二区三区| 激情欧美一区二区三区在线观看| 日韩欧美自拍偷拍| 精品亚洲porn| 久久先锋影音av鲁色资源 | 亚洲va国产va欧美va观看| 一本一本大道香蕉久在线精品| 亚洲私人黄色宅男| 色哟哟国产精品免费观看| 一区二区三区不卡视频在线观看| 一本大道久久精品懂色aⅴ| 亚洲精品久久久蜜桃| 欧美系列在线观看| 视频一区在线播放| 精品91自产拍在线观看一区| 黄色小说综合网站| 中文一区在线播放| 色婷婷av一区二区三区gif | 国产夜色精品一区二区av| 国产精品亚洲一区二区三区妖精 | 国产v日产∨综合v精品视频| 国产精品久久久久久妇女6080| 99视频一区二区| 亚洲午夜影视影院在线观看| 欧美日韩国产精品成人| 日本欧美一区二区三区| 久久久久久久久岛国免费| 成人午夜激情影院| 午夜成人在线视频| 久久亚洲综合色一区二区三区| 不卡av在线网| 日韩av一区二| 中文字幕中文乱码欧美一区二区| 欧美午夜一区二区三区| 青青草97国产精品免费观看| 国产日韩欧美高清| 欧美日韩日日骚| 国产福利一区二区| 亚洲一区二区欧美| 国产欧美一区视频| 欧美日韩亚洲综合一区二区三区| 黑人精品欧美一区二区蜜桃| 亚洲日本电影在线| 欧美精品一区二区三区在线播放| 91啦中文在线观看| 精品一区二区成人精品| 一区二区在线观看视频| 久久婷婷国产综合精品青草| 在线视频一区二区免费| 韩国av一区二区三区在线观看| 伊人开心综合网| 国产丝袜在线精品| 欧美老肥妇做.爰bbww| 99久久免费国产| 国精产品一区一区三区mba桃花| 国产精品久久影院| 精品国产在天天线2019| 在线精品视频免费播放| 成人av在线播放网址| 秋霞午夜鲁丝一区二区老狼| 一个色综合网站| 国产精品午夜免费| 久久综合久久久久88| 欧美精品久久一区| 欧美日韩在线一区二区| 91麻豆自制传媒国产之光| 国产69精品久久久久毛片| 久久成人免费日本黄色| 天天射综合影视| 亚洲电影欧美电影有声小说| 亚洲美女屁股眼交3| 国产精品不卡视频| 欧美国产欧美综合| 久久精品一区二区| 久久先锋影音av鲁色资源 | 在线看不卡av| 色婷婷国产精品久久包臀| 99re成人精品视频| 成人美女视频在线观看18| 国产自产v一区二区三区c| 精品亚洲国内自在自线福利| 精品一区二区久久| 国产乱色国产精品免费视频| 九九精品一区二区| 国内精品第一页| 国产盗摄女厕一区二区三区 | 麻豆国产欧美日韩综合精品二区 | 欧美一级片在线看| 日韩欧美一区二区三区在线| 日韩欧美在线网站| www日韩大片| 国产精品久久免费看| 国产精品毛片高清在线完整版| 中文字幕一区二区视频| 中文字幕一区二区三区视频| 中文字幕在线不卡国产视频| 一区二区三区在线观看欧美| 午夜天堂影视香蕉久久| 蜜桃精品视频在线观看| 国产福利91精品| 色综合视频在线观看| 欧美日韩亚洲另类| 日韩午夜激情av| 国产亚洲成av人在线观看导航| 国产欧美精品一区aⅴ影院| 亚洲人成小说网站色在线| 亚洲成国产人片在线观看| 九一九一国产精品| 99re这里只有精品首页| 欧美美女喷水视频| 欧美精品一区二区三区视频| 国产精品久久久久影视| 亚洲最大成人综合| 久久疯狂做爰流白浆xx| www.99精品| 制服丝袜中文字幕一区| 国产日韩精品一区| 亚洲国产aⅴ成人精品无吗| 久久99最新地址| 91啪在线观看| 欧美成人三级在线| 亚洲精品午夜久久久| 久久99精品网久久| 色综合激情久久| 欧美精品一区视频| 亚洲国产成人va在线观看天堂| 精彩视频一区二区三区| 日本韩国欧美一区二区三区| 日韩美女主播在线视频一区二区三区| 国产欧美一区二区精品性| 亚洲制服丝袜一区| 国产高清精品久久久久| 在线观看91精品国产麻豆| 1区2区3区精品视频| 精品影视av免费| 色吧成人激情小说| 久久精品亚洲乱码伦伦中文| 天天综合色天天综合色h| 91视频免费观看| 久久久一区二区| 日韩成人免费电影| 欧美影院精品一区| 中文字幕在线不卡一区二区三区| 久久99久久99小草精品免视看| 91精品91久久久中77777| 亚洲国产经典视频| 国产一区999| 欧美一区二区精品久久911| 亚洲另类在线一区| 99国产精品国产精品久久| 国产性做久久久久久| 精品综合久久久久久8888| 91精品免费在线观看| 亚洲成在线观看| 欧美午夜一区二区三区免费大片| 国产精品久久久久久久浪潮网站 | 日韩国产欧美在线观看| 欧美性猛片xxxx免费看久爱 | 中文一区一区三区高中清不卡| 激情六月婷婷综合| 日韩欧美一二三区| 秋霞午夜av一区二区三区| 7777精品久久久大香线蕉| 一区二区久久久| 欧美三级视频在线| 亚洲国产日韩a在线播放| 欧美性大战久久久久久久| 亚洲成人av电影|