这篇教程C++ ACQUIRE_LOCK函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ACQUIRE_LOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ ACQUIRE_LOCK函数的具体用法?C++ ACQUIRE_LOCK怎么用?C++ ACQUIRE_LOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ACQUIRE_LOCK函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,
示例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,
示例3: traceGcEvent_stderrstatic 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,
示例4: HvlLockVOIDHvlLock( _In_ PHVL pHvl ){ ACQUIRE_LOCK(pHvl, FALSE); }
开发者ID:340211173,项目名称:Driver,代码行数:7,
示例5: sendMessagevoid 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,
示例6: freeTaskManagernatfreeTaskManager (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(¤tTaskKey);#endif#endif tasksInitialized = 0; return tasksRunning;}
开发者ID:A1kmm,项目名称:ghc,代码行数:35,
示例7: stopTicker/* There may be at most one additional tick fired after a call to this */voidstopTicker(void){ ACQUIRE_LOCK(&mutex); stopped = 1; RELEASE_LOCK(&mutex);}
开发者ID:AaronFriel,项目名称:ghc,代码行数:8,
示例8: workerTaskStopvoidworkerTaskStop (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,
示例9: readIOManagerEventHsWord32readIOManagerEvent (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,
示例10: getIOManagerEventHANDLEgetIOManagerEvent (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,
示例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,
示例12: ParseNET_API_STATUSParse( 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,
示例13: startTickervoidstartTicker(void){ ACQUIRE_LOCK(&mutex); stopped = 0; signalCondition(&start_cond); RELEASE_LOCK(&mutex);}
开发者ID:AaronFriel,项目名称:ghc,代码行数:8,
示例14: definedstatic 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,
示例15: waitConditionboolwaitCondition ( Condition* pCond, Mutex* pMut ){ RELEASE_LOCK(pMut); WaitForSingleObject(*pCond, INFINITE); /* Hmm..use WaitForMultipleObjects() ? */ ACQUIRE_LOCK(pMut); return true;}
开发者ID:bgamari,项目名称:ghc,代码行数:9,
示例16: hs_spt_keysint 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,
示例17: hs_spt_removevoid 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,
示例18: hs_spt_lookupStgPtr 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,
示例19: vtrace_stderrstatic 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,
示例20: updateThreadLabelstatic voidupdateThreadLabel(StgWord key, void *data){ removeThreadLabel(key); ACQUIRE_LOCK(&threadLabels_mutex); insertHashTable(threadLabels,key,data); RELEASE_LOCK(&threadLabels_mutex);}
开发者ID:23Skidoo,项目名称:ghc,代码行数:11,
示例21: lookupStableNameStgWordlookupStableName(StgPtr p){ StgWord res; initStablePtrTable(); ACQUIRE_LOCK(&stable_mutex); res = lookupStableName_(p); RELEASE_LOCK(&stable_mutex); return res;}
开发者ID:Eufavn,项目名称:ghc,代码行数:11,
示例22: vtraceCap_stderrstatic void vtraceCap_stderr(Capability *cap, char *msg, va_list ap){ ACQUIRE_LOCK(&trace_utx); tracePreface(); debugBelch("cap %d: ", cap->no); vdebugBelch(msg,ap); debugBelch("/n"); RELEASE_LOCK(&trace_utx);}
开发者ID:lukemaurer,项目名称:ghc,代码行数:11,
示例23: SrvCheckAndReferenceEndpointBOOLEAN SRVFASTCALLSrvCheckAndReferenceEndpoint ( PENDPOINT Endpoint )/*++Routine Description: This function atomically verifies that an endpoint is active and increments the reference count on the endpoint if it is.Arguments: Endpoint - Address of endpointReturn Value: BOOLEAN - Returns TRUE if the endpoint is active, FALSE otherwise.--*/{ PAGED_CODE( ); // // Acquire the lock that guards the endpoint's state field. // ACQUIRE_LOCK( &SrvEndpointLock ); // // If the endpoint is active, reference it and return TRUE. // if ( GET_BLOCK_STATE(Endpoint) == BlockStateActive ) { SrvReferenceEndpoint( Endpoint ); RELEASE_LOCK( &SrvEndpointLock ); return TRUE; } // // The endpoint isn't active. Return FALSE. // RELEASE_LOCK( &SrvEndpointLock ); return FALSE;} // SrvCheckAndReferenceEndpoint
开发者ID:Gaikokujin,项目名称:WinNT4,代码行数:54,
示例24: freeThreadLabelTablevoidfreeThreadLabelTable(void){ ACQUIRE_LOCK(&threadLabels_mutex); if (threadLabels != NULL) { freeHashTable(threadLabels, stgFree); threadLabels = NULL; } RELEASE_LOCK(&threadLabels_mutex);}
开发者ID:23Skidoo,项目名称:ghc,代码行数:12,
示例25: lookupThreadLabelvoid *lookupThreadLabel(StgWord key){ void * result; ACQUIRE_LOCK(&threadLabels_mutex); result = lookupHashTable(threadLabels,key); RELEASE_LOCK(&threadLabels_mutex); return result;}
开发者ID:23Skidoo,项目名称:ghc,代码行数:12,
示例26: getStablePtrStgStablePtrgetStablePtr(StgPtr p){ StgWord sn; initStablePtrTable(); ACQUIRE_LOCK(&stable_mutex); sn = lookupStableName_(p); stable_ptr_table[sn].ref++; RELEASE_LOCK(&stable_mutex); return (StgStablePtr)(sn);}
开发者ID:Eufavn,项目名称:ghc,代码行数:12,
示例27: ioManagerDievoidioManagerDie (void){ sendIOManagerEvent(IO_MANAGER_DIE); // IO_MANAGER_DIE must be idempotent, as it is called // repeatedly by shutdownCapability(). Try conc059(threaded1) to // illustrate the problem. ACQUIRE_LOCK(&event_buf_mutex); io_manager_event = INVALID_HANDLE_VALUE; RELEASE_LOCK(&event_buf_mutex); // ToDo: wait for the IO manager to pick up the event, and // then release the Event and Mutex objects we've allocated.}
开发者ID:alexbiehl,项目名称:ghc,代码行数:13,
示例28: removeThreadLabelvoidremoveThreadLabel(StgWord key){ ACQUIRE_LOCK(&threadLabels_mutex); void * old = NULL; if ((old = lookupHashTable(threadLabels,key))) { removeHashTable(threadLabels,key,old); stgFree(old); } RELEASE_LOCK(&threadLabels_mutex);}
开发者ID:23Skidoo,项目名称:ghc,代码行数:13,
示例29: RESET_EVENTvoid RESET_EVENT( EVENT_HNDL* pEvent ){ DWORD LockFlag; // clear the event flag ACQUIRE_LOCK( &pEvent->FlagLock, LockFlag ); pEvent->SetFlag = FALSE; // empty out the queue while ( waitqueue_active( &pEvent->WaitQue ) ) interruptible_sleep_on( &pEvent->WaitQue ); RELEASE_LOCK( &pEvent->FlagLock, LockFlag );}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:14,
示例30: traceSchedEvent_stderrstatic void traceSchedEvent_stderr (Capability *cap, EventTypeNum tag, StgTSO *tso, StgWord info1 STG_UNUSED, StgWord info2 STG_UNUSED){ ACQUIRE_LOCK(&trace_utx); tracePreface(); switch (tag) { case EVENT_CREATE_THREAD: // (cap, thread) debugBelch("cap %d: created thread %lu/n", cap->no, (lnat)tso->id); break; case EVENT_RUN_THREAD: // (cap, thread) debugBelch("cap %d: running thread %lu (%s)/n", cap->no, (lnat)tso->id, what_next_strs[tso->what_next]); break; case EVENT_THREAD_RUNNABLE: // (cap, thread) debugBelch("cap %d: thread %lu appended to run queue/n", cap->no, (lnat)tso->id); break; case EVENT_MIGRATE_THREAD: // (cap, thread, new_cap) debugBelch("cap %d: thread %lu migrating to cap %d/n", cap->no, (lnat)tso->id, (int)info1); break; case EVENT_THREAD_WAKEUP: // (cap, thread, info1_cap) debugBelch("cap %d: waking up thread %lu on cap %d/n", cap->no, (lnat)tso->id, (int)info1); break; case EVENT_STOP_THREAD: // (cap, thread, status) if (info1 == 6 + BlockedOnBlackHole) { debugBelch("cap %d: thread %lu stopped (blocked on black hole owned by thread %lu)/n", cap->no, (lnat)tso->id, (long)info2); } else { debugBelch("cap %d: thread %lu stopped (%s)/n", cap->no, (lnat)tso->id, thread_stop_reasons[info1]); } break; case EVENT_SHUTDOWN: // (cap) debugBelch("cap %d: shutting down/n", cap->no); break; default: debugBelch("cap %d: thread %lu: event %d/n/n", cap->no, (lnat)tso->id, tag); break; } RELEASE_LOCK(&trace_utx);}
开发者ID:NathanHowell,项目名称:ghc,代码行数:50,
注:本文中的ACQUIRE_LOCK函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ACRX_T函数代码示例 C++ ACPI_WARNING函数代码示例 |