• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ACQUIRE_LOCK函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ACQUIRE_LOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ ACQUIRE_LOCK函数的具体用法?C++ ACQUIRE_LOCK怎么用?C++ ACQUIRE_LOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ACQUIRE_LOCK函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: traceCapsetEvent_

void traceCapsetEvent_ (EventTypeNum tag,
                        CapsetID capset,
                        StgWord info)
{
#ifdef DEBUG
    if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
        ACQUIRE_LOCK(&trace_utx);

        tracePreface();
        switch (tag) {
        case EVENT_CAPSET_CREATE:   // (capset, capset_type)
            debugBelch("created capset %lu of type %d\n", (lnat)capset, (int)info);
            break;
        case EVENT_CAPSET_DELETE:   // (capset)
            debugBelch("deleted capset %lu\n", (lnat)capset);
            break;
        case EVENT_CAPSET_ASSIGN_CAP:  // (capset, capno)
            debugBelch("assigned cap %lu to capset %lu\n",
                       (lnat)info, (lnat)capset);
            break;
        case EVENT_CAPSET_REMOVE_CAP:  // (capset, capno)
            debugBelch("removed cap %lu from capset %lu\n",
                       (lnat)info, (lnat)capset);
            break;
        }
        RELEASE_LOCK(&trace_utx);
    } else
#endif
    {
        if (eventlog_enabled) {
            postCapsetEvent(tag, capset, info);
        }
    }
}
开发者ID:NathanHowell,项目名称:ghc,代码行数:34,代码来源:Trace.c


示例2: traceCapEvent_

void traceCapEvent_ (Capability   *cap,
                     EventTypeNum  tag)
{
#ifdef DEBUG
    if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
        ACQUIRE_LOCK(&trace_utx);

        tracePreface();
        switch (tag) {
        case EVENT_CAP_CREATE:   // (cap)
            debugBelch("cap %d: initialised\n", cap->no);
            break;
        case EVENT_CAP_DELETE:   // (cap)
            debugBelch("cap %d: shutting down\n", cap->no);
            break;
        case EVENT_CAP_ENABLE:   // (cap)
            debugBelch("cap %d: enabling capability\n", cap->no);
            break;
        case EVENT_CAP_DISABLE:  // (cap)
            debugBelch("cap %d: disabling capability\n", cap->no);
            break;
        }
        RELEASE_LOCK(&trace_utx);
    } else
#endif
    {
        if (eventlog_enabled) {
            postCapEvent(tag, (EventCapNo)cap->no);
        }
    }
}
开发者ID:lukemaurer,项目名称:ghc,代码行数:31,代码来源:Trace.c


示例3: traceGcEvent_stderr

static void traceGcEvent_stderr (Capability *cap, EventTypeNum tag)
{
    ACQUIRE_LOCK(&trace_utx);

    tracePreface();
    switch (tag) {
      case EVENT_REQUEST_SEQ_GC:  // (cap)
          debugBelch("cap %d: requesting sequential GC\n", cap->no);
          break;
      case EVENT_REQUEST_PAR_GC:  // (cap)
          debugBelch("cap %d: requesting parallel GC\n", cap->no);
          break;
      case EVENT_GC_START:        // (cap)
          debugBelch("cap %d: starting GC\n", cap->no);
          break;
      case EVENT_GC_END:          // (cap)
          debugBelch("cap %d: finished GC\n", cap->no);
          break;
      case EVENT_GC_IDLE:         // (cap)
          debugBelch("cap %d: GC idle\n", cap->no);
          break;
      case EVENT_GC_WORK:         // (cap)
          debugBelch("cap %d: GC working\n", cap->no);
          break;
      case EVENT_GC_DONE:         // (cap)
          debugBelch("cap %d: GC done\n", cap->no);
          break;
      default:
          barf("traceGcEvent: unknown event tag %d", tag);
          break;
    }

    RELEASE_LOCK(&trace_utx);
}
开发者ID:NathanHowell,项目名称:ghc,代码行数:34,代码来源:Trace.c


示例4: HvlLock

VOID
HvlLock(
    _In_  PHVL       pHvl
    )
{
    ACQUIRE_LOCK(pHvl, FALSE);                                               
}
开发者ID:340211173,项目名称:Driver,代码行数:7,代码来源:hvl_main.c


示例5: sendMessage

void sendMessage(Capability *from_cap, Capability *to_cap, Message *msg)
{
    ACQUIRE_LOCK(&to_cap->lock);

#ifdef DEBUG    
    {
        const StgInfoTable *i = msg->header.info;
        if (i != &stg_MSG_THROWTO_info &&
            i != &stg_MSG_BLACKHOLE_info &&
            i != &stg_MSG_TRY_WAKEUP_info &&
            i != &stg_IND_info && // can happen if a MSG_BLACKHOLE is revoked
            i != &stg_WHITEHOLE_info) {
            barf("sendMessage: %p", i);
        }
    }
#endif

    msg->link = to_cap->inbox;
    to_cap->inbox = msg;

    recordClosureMutated(from_cap,(StgClosure*)msg);

    if (to_cap->running_task == NULL) {
	to_cap->running_task = myTask(); 
            // precond for releaseCapability_()
        releaseCapability_(to_cap,rtsFalse);
    } else {
        interruptCapability(to_cap);
    }

    RELEASE_LOCK(&to_cap->lock);
}
开发者ID:Eufavn,项目名称:ghc,代码行数:32,代码来源:Messages.c


示例6: freeTaskManager

nat
freeTaskManager (void)
{
    Task *task, *next;
    nat tasksRunning = 0;

    ACQUIRE_LOCK(&all_tasks_mutex);

    for (task = all_tasks; task != NULL; task = next) {
        next = task->all_next;
        if (task->stopped) {
            freeTask(task);
        } else {
            tasksRunning++;
        }
    }

    debugTrace(DEBUG_sched, "freeing task manager, %d tasks still running",
               tasksRunning);

    all_tasks = NULL;

    RELEASE_LOCK(&all_tasks_mutex);

#if defined(THREADED_RTS)
    closeMutex(&all_tasks_mutex); 
#if !defined(MYTASK_USE_TLV)
    freeThreadLocalKey(&currentTaskKey);
#endif
#endif

    tasksInitialized = 0;

    return tasksRunning;
}
开发者ID:A1kmm,项目名称:ghc,代码行数:35,代码来源:Task.c


示例7: stopTicker

/* There may be at most one additional tick fired after a call to this */
void
stopTicker(void)
{
    ACQUIRE_LOCK(&mutex);
    stopped = 1;
    RELEASE_LOCK(&mutex);
}
开发者ID:AaronFriel,项目名称:ghc,代码行数:8,代码来源:Pthread.c


示例8: workerTaskStop

void
workerTaskStop (Task *task)
{
    DEBUG_ONLY( OSThreadId id );
    DEBUG_ONLY( id = osThreadId() );
    ASSERT(task->id == id);
    ASSERT(myTask() == task);

    ACQUIRE_LOCK(&all_tasks_mutex);

    if (task->all_prev) {
        task->all_prev->all_next = task->all_next;
    } else {
        all_tasks = task->all_next;
    }
    if (task->all_next) {
        task->all_next->all_prev = task->all_prev;
    }

    currentWorkerCount--;

    RELEASE_LOCK(&all_tasks_mutex);

    freeTask(task);
}
开发者ID:Eufavn,项目名称:ghc,代码行数:25,代码来源:Task.c


示例9: readIOManagerEvent

HsWord32
readIOManagerEvent (void)
{
    // This function must exist even in non-THREADED_RTS,
    // see getIOManagerEvent() above.
#if defined(THREADED_RTS)
    HsWord32 res;

    ACQUIRE_LOCK(&event_buf_mutex);

    if (io_manager_event != INVALID_HANDLE_VALUE) {
        if (next_event == 0) {
            res = 0; // no event to return
        } else {
            res = (HsWord32)(event_buf[--next_event]);
            if (next_event == 0) {
                if (!ResetEvent(io_manager_event)) {
                    sysErrorBelch("readIOManagerEvent");
                    stg_exit(EXIT_FAILURE);
                }
            }
        }
    } else {
        res = 0;
    }

    RELEASE_LOCK(&event_buf_mutex);

    // debugBelch("readIOManagerEvent: %d\n", res);
    return res;
#else
    return 0;
#endif
}
开发者ID:alexbiehl,项目名称:ghc,代码行数:34,代码来源:ThrIOManager.c


示例10: getIOManagerEvent

HANDLE
getIOManagerEvent (void)
{
    // This function has to exist even in the non-THREADED_RTS,
    // because code in GHC.Conc refers to it.  It won't ever be called
    // unless we're in the threaded RTS, however.
#ifdef THREADED_RTS
    HANDLE hRes;

    ACQUIRE_LOCK(&event_buf_mutex);

    if (io_manager_event == INVALID_HANDLE_VALUE) {
        hRes = CreateEvent ( NULL, // no security attrs
                             true, // manual reset
                             false, // initial state,
                             NULL ); // event name: NULL for private events
        if (hRes == NULL) {
            sysErrorBelch("getIOManagerEvent");
            stg_exit(EXIT_FAILURE);
        }
        io_manager_event = hRes;
    } else {
        hRes = io_manager_event;
    }

    RELEASE_LOCK(&event_buf_mutex);
    return hRes;
#else
    return NULL;
#endif
}
开发者ID:alexbiehl,项目名称:ghc,代码行数:31,代码来源:ThrIOManager.c


示例11: startSignalHandlers

/*
 * Function: startSignalHandlers()
 *
 * Run the handlers associated with the stacked up console events. Console
 * event delivery is blocked for the duration of this call.
 */
void startSignalHandlers(Capability *cap)
{
    StgStablePtr handler;

    if (console_handler < 0) {
        return;
    }

    blockUserSignals();
    ACQUIRE_LOCK(&sched_mutex);

    handler = deRefStablePtr((StgStablePtr)console_handler);
    while (stg_pending_events > 0) {
        stg_pending_events--;
        scheduleThread(cap,
            createIOThread(cap,
                RtsFlags.GcFlags.initialStkSize,
                rts_apply(cap,
                    (StgClosure *)handler,
                    rts_mkInt(cap,
                        stg_pending_buf[stg_pending_events]))));
    }

    RELEASE_LOCK(&sched_mutex);
    unblockUserSignals();
}
开发者ID:alexbiehl,项目名称:ghc,代码行数:32,代码来源:ConsoleHandler.c


示例12: Parse

NET_API_STATUS
Parse(
    IN DWORD argc,
    IN LPTSTR argv[]
    )
/*++

Routine Description :

    Wrapper function of the real worker Parse2 function.

Arguments :
    argc : argument count
    argv : argument string array pointer.

Return Value :
    return  NO_ERROR if successfully parse parameter
            ERROR_INVALID_PARAMETER, otherwise

--*/
{
    NET_API_STATUS  ApiStatus;
    LPNET_CONFIG_HANDLE ConfigHandle;

    // Get read-write lock for config data.  (The lock is for the in-memory
    // version of the data, which we're going to set.)
    ACQUIRE_LOCK( ReplGlobalConfigLock );

    // Open the config file (nt.cfg)
    ApiStatus = NetpOpenConfigData(
            & ConfigHandle,
            NULL,                 // local machine
            SECT_NT_REPLICATOR,   // section name
            TRUE);                // read-only


    if (ApiStatus != NO_ERROR) {
        NetpKdPrint(( "[REPL] Parse() can't open config section.\n" ));
        ReplFinish(
            SERVICE_UIC_CODE(
                SERVICE_UIC_SYSTEM,
                ApiStatus),
            NULL);

        RELEASE_LOCK( ReplGlobalConfigLock );
        return( ApiStatus );
    }


    ApiStatus = Parse2(argc, argv, ConfigHandle);

    // close config file ..

    (void) NetpCloseConfigData( ConfigHandle );

    RELEASE_LOCK( ReplGlobalConfigLock );

    return( ApiStatus );
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:59,代码来源:parse.c


示例13: startTicker

void
startTicker(void)
{
    ACQUIRE_LOCK(&mutex);
    stopped = 0;
    signalCondition(&start_cond);
    RELEASE_LOCK(&mutex);
}
开发者ID:AaronFriel,项目名称:ghc,代码行数:8,代码来源:Pthread.c


示例14: defined

static void *itimer_thread_func(void *_handle_tick)
{
    TickProc handle_tick = _handle_tick;
    uint64_t nticks;
    int timerfd = -1;

#if defined(USE_TIMERFD_FOR_ITIMER) && USE_TIMERFD_FOR_ITIMER
    struct itimerspec it;
    it.it_value.tv_sec  = TimeToSeconds(itimer_interval);
    it.it_value.tv_nsec = TimeToNS(itimer_interval) % 1000000000;
    it.it_interval = it.it_value;

    timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
    if (timerfd == -1) {
        sysErrorBelch("timerfd_create");
        stg_exit(EXIT_FAILURE);
    }
    if (!TFD_CLOEXEC) {
      fcntl(timerfd, F_SETFD, FD_CLOEXEC);
    }
    if (timerfd_settime(timerfd, 0, &it, NULL)) {
        sysErrorBelch("timerfd_settime");
        stg_exit(EXIT_FAILURE);
    }
#endif

    while (!exited) {
        if (USE_TIMERFD_FOR_ITIMER) {
            if (read(timerfd, &nticks, sizeof(nticks)) != sizeof(nticks)) {
                if (errno != EINTR) {
                    sysErrorBelch("Itimer: read(timerfd) failed");
                }
            }
        } else {
            if (usleep(TimeToUS(itimer_interval)) != 0 && errno != EINTR) {
                sysErrorBelch("usleep(TimeToUS(itimer_interval) failed");
            }
        }

        // first try a cheap test
        if (stopped) {
            ACQUIRE_LOCK(&mutex);
            // should we really stop?
            if (stopped) {
                waitCondition(&start_cond, &mutex);
            }
            RELEASE_LOCK(&mutex);
        } else {
            handle_tick(0);
        }
    }

    if (USE_TIMERFD_FOR_ITIMER)
        close(timerfd);
    closeMutex(&mutex);
    closeCondition(&start_cond);
    return NULL;
}
开发者ID:AaronFriel,项目名称:ghc,代码行数:58,代码来源:Pthread.c


示例15: waitCondition

bool
waitCondition ( Condition* pCond, Mutex* pMut )
{
  RELEASE_LOCK(pMut);
  WaitForSingleObject(*pCond, INFINITE);
  /* Hmm..use WaitForMultipleObjects() ? */
  ACQUIRE_LOCK(pMut);
  return true;
}
开发者ID:bgamari,项目名称:ghc,代码行数:9,代码来源:OSThreads.c


示例16: hs_spt_keys

int hs_spt_keys(StgPtr keys[], int szKeys) {
  if (spt) {
    ACQUIRE_LOCK(&spt_lock);
    const int ret = keysHashTable(spt, (StgWord*)keys, szKeys);
    RELEASE_LOCK(&spt_lock);
    return ret;
  } else
    return 0;
}
开发者ID:23Skidoo,项目名称:ghc,代码行数:9,代码来源:StaticPtrTable.c


示例17: hs_spt_remove

void hs_spt_remove(StgWord64 key[2]) {
   if (spt) {
     ACQUIRE_LOCK(&spt_lock);
     StgStablePtr* entry = removeHashTable(spt, (StgWord)key, NULL);
     RELEASE_LOCK(&spt_lock);

     if (entry)
       freeSptEntry(entry);
   }
}
开发者ID:23Skidoo,项目名称:ghc,代码行数:10,代码来源:StaticPtrTable.c


示例18: hs_spt_lookup

StgPtr hs_spt_lookup(StgWord64 key[2]) {
  if (spt) {
    ACQUIRE_LOCK(&spt_lock);
    const StgStablePtr * entry = lookupHashTable(spt, (StgWord)key);
    RELEASE_LOCK(&spt_lock);
    const StgPtr ret = entry ? deRefStablePtr(*entry) : NULL;
    return ret;
  } else
    return NULL;
}
开发者ID:23Skidoo,项目名称:ghc,代码行数:10,代码来源:StaticPtrTable.c


示例19: vtrace_stderr

static void vtrace_stderr(char *msg, va_list ap)
{
    ACQUIRE_LOCK(&trace_utx);

    tracePreface();
    vdebugBelch(msg,ap);
    debugBelch("\n");

    RELEASE_LOCK(&trace_utx);
}
开发者ID:lukemaurer,项目名称:ghc,代码行数:10,代码来源:Trace.c


示例20: updateThreadLabel

static void
updateThreadLabel(StgWord key, void *data)
{
  removeThreadLabel(key);

  ACQUIRE_LOCK(&threadLabels_mutex);

  insertHashTable(threadLabels,key,data);

  RELEASE_LOCK(&threadLabels_mutex);
}
开发者ID:23Skidoo,项目名称:ghc,代码行数:11,代码来源:ThreadLabels.c



注:本文中的ACQUIRE_LOCK函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ACRX_T函数代码示例发布时间:2022-05-30
下一篇:
C++ ACPI_WARNING函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap