本文整理汇总了C++中RELEASE_LOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ RELEASE_LOCK函数的具体用法?C++ RELEASE_LOCK怎么用?C++ RELEASE_LOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RELEASE_LOCK函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: channel_clear
int
channel_clear(void)
{
int cca;
int radio_was_off = 0;
PRINTF("CCA\n");
/* If the radio is locked by an underlying thread (because we are
being invoked through an interrupt), we preted that the coast is
clear (i.e., no packet is currently being transmitted by a
neighbor). */
if(locked) {
return 1;
}
GET_LOCK();
if(!receive_on) {
radio_was_off = 1;
cc2520_on();
}
/* Make sure that the radio really got turned on. */
if(!receive_on) {
RELEASE_LOCK();
if(radio_was_off) {
cc2520_off();
}
return 1;
}
cca = cc2520ll_channel_clear();
if(radio_was_off) {
cc2520_off();
}
RELEASE_LOCK();
return cca;
}
开发者ID:mikewen,项目名称:virtual-sense,代码行数:34,代码来源:radio-driver.c
示例2: ListFree
PRIVATE
void
ListFree( void * unit )
{
int done = FALSE;
LIST_UNIT * lu;
ALLOC_UNIT * t = NULL;
ALLOC_UNIT * tbl = NULL;
WAIT_FOR_LOCK( LIST_MUTEX );
for( t = GLOBAL_ALLOC_TABLE; t; t = (ALLOC_UNIT *)tbl -> prev )
tbl = t;
if( !tbl )
{
DBG(PF( "Error freeing list structure.\n" ));
RELEASE_LOCK( LIST_MUTEX );
return;
}
lu = (LIST_UNIT *)( (int) unit - sizeof( int ) );
if( lu -> check != ALLOC_USED_FLAG )
{
ERROR( "Free of a corrupt list node from allocation table." );
RELEASE_LOCK( LIST_MUTEX );
return;
}
do
{
if ( (unit >= tbl -> min) && (unit < tbl -> max) )
{
tbl -> avail++;
lu -> check = ALLOC_FREE_FLAG;
lu -> ptr_a = NULL;
lu -> ptr_b = NULL;
lu -> ptr_c = NULL;
done = TRUE;
break;
}
else
{
tbl = (ALLOC_UNIT *)tbl -> next;
}
} while( tbl && !done );
if ( !done )
ERROR( "Couldn't find list in allocation table\n" );
RELEASE_LOCK( LIST_MUTEX );
}
开发者ID:FreeFalcon,项目名称:freefalcon-central,代码行数:60,代码来源:lists.c
示例3: 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
示例4: rtp_sinker_consume
static int32_t
rtp_sinker_consume(network_sinker *ns, proto_watch *pw,
int32_t stm_i, msg *m, uint32_t seq)
{
int32_t ret = -ENOMEM;
media_sinker *sinker = (media_sinker*)ns;
rtp_sinker *rs = (rtp_sinker*)ns;
media_sinker *ms = (media_sinker*)ns;
mem_block *mb;
network_client *nc = (network_client*)rs->interleaved;
if (rs->trans_mode == RTP_OVER_UDP)
{
BUG_ON(!pw);
proto_watch_ref(pw);
RELEASE_LOCK(sinker->lock);
msg_ref(m);
ret = proto_watch_write(pw, m, seq, 0);
proto_watch_unref(pw);
AQUIRE_LOCK(sinker->lock);
return ret;
}
mb = rtp_msg_to_interleaved_mb(m, ns->stms[stm_i].interleaved);
if (mb)
{
MEMBLOCK_SET_SEQ(mb, seq);
if (rs->trans_mode == RTP_OVER_TCP)
{
BUG_ON(!pw);
proto_watch_ref(pw);
RELEASE_LOCK(sinker->lock);
msg_ref(m);
ret = proto_watch_write_mb(pw, mb, 0);
proto_watch_unref(pw);
AQUIRE_LOCK(sinker->lock);
}
else
{
BUG_ON(!nc);
RELEASE_LOCK(ms->lock);
msg_ref(m);
ret = network_client_send_mb(nc, mb, 0);
AQUIRE_LOCK(ms->lock);
}
}
return ret;
}
开发者ID:dulton,项目名称:nampu,代码行数:55,代码来源:rtp_sinker.c
示例5: ldl_op_fuck
static void
ldl_op_fuck(void *data, void *user_data)
{
int32_t err;
media_info msi;
tp_block *tb = (tp_block*)data;
ldl_src *ldl = (ldl_src*)tb->ls;
switch (tb->action)
{
case ACTION_PROBE:
media_info_init(&msi);
err = __ldl_src_probe(ldl, &tb->mrl, &msi);
media_src_fill_info((media_src*)ldl, &msi, err);
media_info_clear(&msi);
#ifdef DEVICE_INTERFACE_TEST
void ldl_interfaces_test(media_uri *mrl);
ldl_interfaces_test(&tb->mrl);
#endif
break;
case ACTION_OPEN:
AQUIRE_LOCK(ldl->ldl_lock);
err = __ldl_src_open(ldl, &tb->mrl);
RELEASE_LOCK(ldl->ldl_lock);
media_src_open_end((media_src*)ldl, err);
break;
case ACTION_PLAY:
AQUIRE_LOCK(ldl->ldl_lock);
__ldl_src_play(ldl);
RELEASE_LOCK(ldl->ldl_lock);
break;
case ACTION_CTRL:
AQUIRE_LOCK(ldl->ldl_lock);
__ldl_src_ctrl(ldl, 1, NULL);
RELEASE_LOCK(ldl->ldl_lock);
break;
case ACTION_CLOSE:
AQUIRE_LOCK(ldl->ldl_lock);
__ldl_src_kill(ldl);
RELEASE_LOCK(ldl->ldl_lock);
break;
default:
break;
}
media_src_unref((media_src*)ldl);
tr_free(tb, sizeof(*tb));
}
开发者ID:dulton,项目名称:nampu,代码行数:54,代码来源:ldl_src.c
示例6: SrvCheckAndReferenceEndpoint
BOOLEAN SRVFASTCALL
SrvCheckAndReferenceEndpoint (
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 endpoint
Return 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,代码来源:blkendp.c
示例7: send
/*---------------------------------------------------------------------------*/
static int
send(const void *payload, unsigned short payload_len)
{
int res = 0;
GET_LOCK();
cc2520ll_prepare(payload, payload_len);
RELEASE_LOCK();
GET_LOCK();
res = cc2520ll_transmit();
RELEASE_LOCK();
return res;
}
开发者ID:mikewen,项目名称:virtual-sense,代码行数:14,代码来源:radio-driver.c
示例8: cc2520_prepare
/*---------------------------------------------------------------------------*/
static int
cc2520_prepare(const void *payload, unsigned short payload_len)
{
uint8_t total_len;
GET_LOCK();
PRINTF("cc2520: sending %d bytes\n", payload_len);
/*int i;
for(i = 0; i < payload_len;i++)
printf("%x",((uint8_t *) payload)[i]);
printf("\n");*/
RIMESTATS_ADD(lltx);
/* Wait for any previous transmission to finish. */
/* while(status() & BV(CC2520_TX_ACTIVE));*/
/* Write packet to TX FIFO. */
strobe(CC2520_INS_SFLUSHTX);
total_len = payload_len + FOOTER_LEN;
CC2520_WRITE_FIFO_BUF(&total_len, 1);
CC2520_WRITE_FIFO_BUF(payload, payload_len);
RELEASE_LOCK();
return 0;
}
开发者ID:1uk3,项目名称:contiki,代码行数:27,代码来源:cc2520.c
示例9: cc2420_set_channel
/*---------------------------------------------------------------------------*/
int
cc2420_set_channel(int c)
{
uint16_t f;
GET_LOCK();
/*
* Subtract the base channel (11), multiply by 5, which is the
* channel spacing. 357 is 2405-2048 and 0x4000 is LOCK_THR = 1.
*/
channel = c;
f = 5 * (c - 11) + 357 + 0x4000;
/*
* Writing RAM requires crystal oscillator to be stable.
*/
BUSYWAIT_UNTIL((status() & (BV(CC2420_XOSC16M_STABLE))), RTIMER_SECOND / 10);
/* Wait for any transmission to end. */
BUSYWAIT_UNTIL(!(status() & BV(CC2420_TX_ACTIVE)), RTIMER_SECOND / 10);
setreg(CC2420_FSCTRL, f);
/* If we are in receive mode, we issue an SRXON command to ensure
that the VCO is calibrated. */
if(receive_on) {
strobe(CC2420_SRXON);
}
RELEASE_LOCK();
return 1;
}
开发者ID:leoqin,项目名称:Contiki-leo,代码行数:33,代码来源:cc2420.c
示例10: cc2420_prepare
/*---------------------------------------------------------------------------*/
static int
cc2420_prepare(const void *payload, unsigned short payload_len)
{
uint8_t total_len;
#if CC2420_CONF_CHECKSUM
uint16_t checksum;
#endif /* CC2420_CONF_CHECKSUM */
GET_LOCK();
PRINTF("cc2420: sending %d bytes\n", payload_len);
RIMESTATS_ADD(lltx);
/* Wait for any previous transmission to finish. */
/* while(status() & BV(CC2420_TX_ACTIVE));*/
/* Write packet to TX FIFO. */
strobe(CC2420_SFLUSHTX);
#if CC2420_CONF_CHECKSUM
checksum = crc16_data(payload, payload_len, 0);
#endif /* CC2420_CONF_CHECKSUM */
total_len = payload_len + AUX_LEN;
CC2420_WRITE_FIFO_BUF(&total_len, 1);
CC2420_WRITE_FIFO_BUF(payload, payload_len);
#if CC2420_CONF_CHECKSUM
CC2420_WRITE_FIFO_BUF(&checksum, CHECKSUM_LEN);
#endif /* CC2420_CONF_CHECKSUM */
RELEASE_LOCK();
return 0;
}
开发者ID:leoqin,项目名称:Contiki-leo,代码行数:33,代码来源:cc2420.c
示例11: 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
示例12: cc2520_rssi
/*---------------------------------------------------------------------------*/
int
cc2520_rssi(void)
{
int rssi;
int radio_was_off = 0;
if(locked) {
return 0;
}
GET_LOCK();
if(!receive_on) {
radio_was_off = 1;
cc2520_on();
}
BUSYWAIT_UNTIL(status() & BV(CC2520_RSSI_VALID), RTIMER_SECOND / 100);
rssi = (int)((signed char)getreg(CC2520_RSSI));
if(radio_was_off) {
cc2520_off();
}
RELEASE_LOCK();
return rssi;
}
开发者ID:1uk3,项目名称:contiki,代码行数:27,代码来源:cc2520.c
示例13: cc2520_set_pan_addr
/*---------------------------------------------------------------------------*/
void
cc2520_set_pan_addr(unsigned pan,
unsigned addr,
const uint8_t *ieee_addr)
{
uint8_t tmp[2];
GET_LOCK();
/*
* Writing RAM requires crystal oscillator to be stable.
*/
BUSYWAIT_UNTIL(status() & (BV(CC2520_XOSC16M_STABLE)), RTIMER_SECOND / 10);
tmp[0] = pan & 0xff;
tmp[1] = pan >> 8;
CC2520_WRITE_RAM(&tmp, CC2520RAM_PANID, 2);
tmp[0] = addr & 0xff;
tmp[1] = addr >> 8;
CC2520_WRITE_RAM(&tmp, CC2520RAM_SHORTADDR, 2);
if(ieee_addr != NULL) {
int f;
uint8_t tmp_addr[8];
// LSB first, MSB last for 802.15.4 addresses in CC2520
for (f = 0; f < 8; f++) {
tmp_addr[7 - f] = ieee_addr[f];
}
CC2520_WRITE_RAM(tmp_addr, CC2520RAM_IEEEADDR, 8);
}
RELEASE_LOCK();
}
开发者ID:1uk3,项目名称:contiki,代码行数:34,代码来源:cc2520.c
示例14: 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(¤tTaskKey);
#endif
#endif
tasksInitialized = 0;
return tasksRunning;
}
开发者ID:A1kmm,项目名称:ghc,代码行数:35,代码来源:Task.c
示例15: 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
示例16: 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
示例17: cc2520_off
/*---------------------------------------------------------------------------*/
int
cc2520_off(void)
{
PRINTF("OFF\n");
/* Don't do anything if we are already turned off. */
if(receive_on == 0) {
//PRINTF("DONT CALL OFF WAS OFF\n");
return 1;
}
/* If we are called when the driver is locked, we indicate that the
radio should be turned off when the lock is unlocked. */
if(locked) {
/* PRINTF("Off when locked (%d)\n", locked);*/
lock_off = 1;
//PRINTF("DONT CALL OFF WAS LOCKED SCHEDULE OFF\n");
return 1;
}
GET_LOCK();
/* If we are currently receiving a packet (indicated by SFD == 1),
we don't actually switch the radio off now, but signal that the
driver should switch off the radio once the packet has been
received and processed, by setting the 'lock_off' variable. */
if(cc2520ll_rxtx_packet()) {
//PRINTF("DONT CALL OFF WAS LOCKED SCHEDULE OFF BUSY\n");
lock_off = 1;
} else {
//PRINTF("CALL OFF WAS ON\n");
off();
}
RELEASE_LOCK();
return 1;
}
开发者ID:mikewen,项目名称:virtual-sense,代码行数:35,代码来源:radio-driver.c
示例18: 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
示例19: cc2520_off
/*---------------------------------------------------------------------------*/
int
cc2520_off(void)
{
/* Don't do anything if we are already turned off. */
if(receive_on == 0) {
return 1;
}
/* If we are called when the driver is locked, we indicate that the
radio should be turned off when the lock is unlocked. */
if(locked) {
/* printf("Off when locked (%d)\n", locked);*/
lock_off = 1;
return 1;
}
GET_LOCK();
/* If we are currently receiving a packet (indicated by SFD == 1),
we don't actually switch the radio off now, but signal that the
driver should switch off the radio once the packet has been
received and processed, by setting the 'lock_off' variable. */
if(status() & BV(CC2520_TX_ACTIVE)) {
lock_off = 1;
} else {
off();
}
RELEASE_LOCK();
return 1;
}
开发者ID:1uk3,项目名称:contiki,代码行数:30,代码来源:cc2520.c
示例20: ListGlobalFree
PUBLIC
void
ListGlobalFree( void )
{
ALLOC_UNIT * table, *tblptr;
WAIT_FOR_LOCK( LIST_MUTEX );
if( !GLOBAL_ALLOC_TABLE )
return;
table = GLOBAL_ALLOC_TABLE;
while( table -> prev )
table = table -> prev;
for( ; table ; )
{
tblptr = table -> next;
#ifdef USE_SH_POOLS
MemFreePtr( table );
#else
MemFree( table );
#endif
table = tblptr;
}
GLOBAL_ALLOC_TABLE = NULL;
RELEASE_LOCK( LIST_MUTEX );
}
开发者ID:FreeFalcon,项目名称:freefalcon-central,代码行数:31,代码来源:lists.c
注:本文中的RELEASE_LOCK函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论