本文整理汇总了C++中chMtxUnlock函数的典型用法代码示例。如果您正苦于以下问题:C++ chMtxUnlock函数的具体用法?C++ chMtxUnlock怎么用?C++ chMtxUnlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了chMtxUnlock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ephemeris_new
static void ephemeris_new(ephemeris_t *e)
{
gps_time_t t = get_current_time();
if (!ephemeris_good(&es[e->sid.sat], t)) {
/* Our currently used ephemeris is bad, so we assume this is better. */
log_info("New untrusted ephemeris for PRN %02d", e->sid.sat+1);
chMtxLock(&es_mutex);
es[e->sid.sat] = es_candidate[e->sid.sat] = *e;
chMtxUnlock();
} else if (ephemeris_equal(&es_candidate[e->sid.sat], e)) {
/* The received ephemeris matches our candidate, so we trust it. */
log_info("New trusted ephemeris for PRN %02d", e->sid.sat+1);
chMtxLock(&es_mutex);
es[e->sid.sat] = *e;
chMtxUnlock();
} else {
/* This is our first reception of this new ephemeris, so treat it with
* suspicion and call it the new candidate. */
log_info("New ephemeris candidate for PRN %02d", e->sid.sat+1);
chMtxLock(&es_mutex);
es_candidate[e->sid.sat] = *e;
chMtxUnlock();
}
}
开发者ID:a4a881d4,项目名称:piksi_firmware,代码行数:25,代码来源:ephemeris.c
示例2: gadcLowSpeedStart
bool_t gadcLowSpeedStart(uint32_t physdev, adcsample_t *buffer, GADCCallbackFunction fn, void *param) {
struct lsdev *p;
DoInit();
/* Start the Low Speed Timer */
chMtxLock(&gadcmutex);
if (!gtimerIsActive(&LowSpeedGTimer))
gtimerStart(&LowSpeedGTimer, LowSpeedGTimerCallback, NULL, TRUE, TIME_INFINITE);
/* Find a slot */
for(p = ls; p < &ls[GADC_MAX_LOWSPEED_DEVICES]; p++) {
if (!(p->flags & GADC_FLG_ISACTIVE)) {
/* We know we have a slot - this should never wait anyway */
chSemWaitTimeout(&gadcsem, TIME_IMMEDIATE);
p->lld.physdev = physdev;
p->lld.buffer = buffer;
p->fn = fn;
p->param = param;
p->flags = GADC_FLG_ISACTIVE;
chMtxUnlock();
StartADC(FALSE);
return TRUE;
}
}
chMtxUnlock();
return FALSE;
}
开发者ID:niamster,项目名称:ChibiOS-GFX,代码行数:28,代码来源:gadc.c
示例3: rawd_new
static void rawd_new(struct netconn *nc)
{
int i;
int free = -1;
chMtxLock(&rawd_mutex);
/* check for existing connections */
for (i = 0; i < NC_COUNT; i++) {
if (ncs[i] == NULL) {
free = i;
} else if (ncs[i]->pcb.tcp->state != ESTABLISHED) {
/* kill stale connections */
netconn_close(ncs[i]);
netconn_delete(ncs[i]);
ncs[i] = NULL;
free = i;
}
}
if (free < 0) {
netconn_write(nc, RAWD_FULL, sizeof(RAWD_FULL) - 1, NETCONN_COPY);
netconn_close(nc);
netconn_delete(nc);
chMtxUnlock();
return;
}
ncs[free] = nc;
chMtxUnlock();
netconn_write(nc, RAWD_READY, sizeof(RAWD_READY) - 1, NETCONN_COPY);
}
开发者ID:fabiobaltieri,项目名称:nrf-ethernet,代码行数:34,代码来源:rawd.c
示例4: uart_put_buffer
/**
* Uart transmit buffer implementation
*/
void uart_put_buffer(struct uart_periph *p, long fd, const uint8_t *data, uint16_t len)
{
struct SerialInit *init_struct = (struct SerialInit*)(p->init_struct);
if (fd == 0) {
// if fd is zero, assume the driver is not already locked
// and available space should be checked
chMtxLock(init_struct->tx_mtx);
int16_t space = p->tx_extract_idx - p->tx_insert_idx;
if (space <= 0) {
space += UART_TX_BUFFER_SIZE;
}
if ((uint16_t)(space - 1) < len) {
chMtxUnlock(init_struct->tx_mtx);
return; // no room
}
}
// insert data into buffer
int i;
for (i = 0; i < len; i++) {
p->tx_buf[p->tx_insert_idx] = data[i];
p->tx_insert_idx = (p->tx_insert_idx + 1) % UART_TX_BUFFER_SIZE;
}
// unlock if needed
if (fd == 0) {
chMtxUnlock(init_struct->tx_mtx);
// send signal to start transmission
chSemSignal (init_struct->tx_sem);
}
}
开发者ID:enacuavlab,项目名称:paparazzi,代码行数:32,代码来源:uart_arch.c
示例5: cmp_lists
uint8_t cmp_lists(uint16_t leaf, void *buf, uint8_t length)
{
chMtxLock(&tree_mtx);
uint16_t b = memory_get_ids_head(leaf);
if (b == NO_BUCKET) {
chMtxUnlock();
return 0;
}
uint64_t hash = BUCKET_READ_FIELD(b, type.id, 64);
uint8_t nb_to_send = 0;
unsigned int i = 0;
while(b != NO_NEXT && i < length)
if(hash == ((uint64_t *) buf)[i+1]) {
b = BUCKET_READ_FIELD(b, next_id, 16);
i++;
} else if(BUCKET_READ_FIELD(b, type.id, 64) < ((uint64_t *) buf)[i+1]){
i++;
} else {
((uint16_t *) buf)[nb_to_send++] = b;
b = BUCKET_READ_FIELD(b, next_id, 16);
}
while(b != NO_NEXT) {
((uint16_t *) buf)[nb_to_send++] = b;
b = BUCKET_READ_FIELD(b, next_id, 16);
}
chMtxUnlock();
return nb_to_send;
}
开发者ID:mattwilliamson,项目名称:WaDeD,代码行数:31,代码来源:tree.c
示例6: tree_insert
uint16_t tree_insert(struct Bucket *b)
{
chMtxLock(&tree_mtx);
uint16_t id = place_message(b);
if(id == MEM_FULL) {
chMtxUnlock();
return MEM_FULL;
}
update_branch(id);
chMtxUnlock();
return id;
}
开发者ID:mattwilliamson,项目名称:WaDeD,代码行数:12,代码来源:tree.c
示例7: THD_FUNCTION
static THD_FUNCTION(thread11, p) {
chMtxLock(&m2);
chMtxLock(&m1);
#if CH_CFG_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__)
chCondWaitTimeout(&c1, TIME_INFINITE);
#else
chCondWait(&c1);
#endif
test_emit_token(*(char *)p);
chMtxUnlock(&m1);
chMtxUnlock(&m2);
}
开发者ID:MultiCalorNV,项目名称:verventa-web_Int,代码行数:13,代码来源:testmtx.c
示例8: motor_beep
void motor_beep(int frequency, int duration_msec)
{
chMtxLock(&_mutex);
if (motor_rtctl_get_state() == MOTOR_RTCTL_STATE_IDLE) {
_state.beep_frequency = frequency;
_state.beep_duration_msec = duration_msec;
chMtxUnlock();
chEvtBroadcastFlags(&_setpoint_update_event, ALL_EVENTS); // Wake the control thread
} else {
chMtxUnlock();
}
}
开发者ID:JarryChou,项目名称:sapog,代码行数:13,代码来源:motor.c
示例9: thread3L
/* Low priority thread */
static msg_t thread3L(void *p) {
(void)p;
chThdSleepMilliseconds(10);
chMtxLock(&m2);
test_cpu_pulse(20);
chMtxLock(&m1);
test_cpu_pulse(10);
chMtxUnlock();
test_cpu_pulse(10);
chMtxUnlock();
test_emit_token('D');
return 0;
}
开发者ID:ColonelPanic42,项目名称:ChibiOS-RPi,代码行数:15,代码来源:testmtx.c
示例10: geventSendEvent
void geventSendEvent(GSourceListener *psl) {
chMtxLock(&geventMutex);
if (psl->pListener->callback) { // This test needs to be taken inside the mutex
chMtxUnlock();
// We already know we have the event lock
psl->pListener->callback(psl->pListener->param, &psl->pListener->event);
} else {
// Wake up the listener
if (chSemGetCounterI(&psl->pListener->waitqueue) < 0)
chSemSignal(&psl->pListener->waitqueue);
chMtxUnlock();
}
}
开发者ID:niamster,项目名称:ChibiOS-GFX,代码行数:14,代码来源:gevent.c
示例11: thread11
static msg_t thread11(void *p) {
chMtxLock(&m2);
chMtxLock(&m1);
#if CH_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__)
chCondWaitTimeout(&c1, TIME_INFINITE);
#else
chCondWait(&c1);
#endif
test_emit_token(*(char *)p);
chMtxUnlock();
chMtxUnlock();
return 0;
}
开发者ID:ColonelPanic42,项目名称:ChibiOS-RPi,代码行数:14,代码来源:testmtx.c
示例12: toggleLeds
void toggleLeds( uint32_t arg )
{
chMtxLock( &mutex );
value = ( value & ( ~arg ) ) |
( (value ^ arg ) & (arg & 0x07) );
chMtxUnlock();
}
开发者ID:z80,项目名称:digitizer,代码行数:7,代码来源:led_ctrl.c
示例13: motor_get_limit_mask
int motor_get_limit_mask(void)
{
chMtxLock(&_mutex);
int ret = _state.limit_mask;
chMtxUnlock();
return ret;
}
开发者ID:JarryChou,项目名称:sapog,代码行数:7,代码来源:motor.c
示例14: gdispInit
bool_t gdispInit(void) {
bool_t res;
unsigned i;
/* Mark all the Messages as free */
for(i=0; i < GDISP_QUEUE_SIZE; i++)
gdispMsgs[i].action = GDISP_LLD_MSG_NOP;
/* Initialise our Mailbox, Mutex's and Counting Semaphore.
* A Mutex is required as well as the Mailbox and Thread because some calls have to be synchronous.
* Synchronous calls get handled by the calling thread, asynchronous by our worker thread.
*/
chMBInit(&gdispMailbox, gdispMailboxQueue, sizeof(gdispMailboxQueue)/sizeof(gdispMailboxQueue[0]));
chMtxInit(&gdispMutex);
chMtxInit(&gdispMsgsMutex);
chSemInit(&gdispMsgsSem, GDISP_QUEUE_SIZE);
lldThread = chThdCreateStatic(waGDISPThread, sizeof(waGDISPThread), NORMALPRIO, GDISPThreadHandler, NULL);
/* Initialise driver - synchronous */
chMtxLock(&gdispMutex);
res = gdisp_lld_init();
chMtxUnlock();
return res;
}
开发者ID:niamster,项目名称:ChibiOS-GFX,代码行数:26,代码来源:gdisp.c
示例15: clarityMgmtResponseMonitoringThd
static msg_t clarityMgmtResponseMonitoringThd(void *arg)
{
uint32_t attempts = 0;
(void)arg;
#if CH_USE_REGISTRY == TRUE
chRegSetThreadName(__FUNCTION__);
#endif
while (chThdShouldTerminate() == FALSE)
{
if (chMtxTryLock(cc3000Mtx) == TRUE)
{
chMtxUnlock();
attempts = 0;
}
else
{
attempts++;
if (attempts == CC3000_MUTEX_POLL_COUNT)
{
unresponsiveCb();
}
}
chThdSleep(MS2ST(CC3000_MUTEX_POLL_TIME_MS));
}
return CLARITY_SUCCESS;
}
开发者ID:alanbarr,项目名称:clarity,代码行数:30,代码来源:mgmt.c
示例16: state
void state( uint8_t index, uint32_t * val )
{
// Mutex protected.
chMtxLock( &mutex );
*val = ins[index];
chMtxUnlock();
}
开发者ID:z80,项目名称:IPM,代码行数:7,代码来源:i2c_ctrl.c
示例17: motor_is_idle
bool motor_is_idle(void)
{
chMtxLock(&_mutex);
bool ret = motor_rtctl_get_state() == MOTOR_RTCTL_STATE_IDLE;
chMtxUnlock();
return ret;
}
开发者ID:JarryChou,项目名称:sapog,代码行数:7,代码来源:motor.c
示例18: motor_test_motor
int motor_test_motor(void)
{
chMtxLock(&_mutex);
const int res = motor_rtctl_test_motor();
chMtxUnlock();
return res;
}
开发者ID:JarryChou,项目名称:sapog,代码行数:7,代码来源:motor.c
示例19: motor_is_running
bool motor_is_running(void)
{
chMtxLock(&_mutex);
bool ret = motor_rtctl_get_state() == MOTOR_RTCTL_STATE_RUNNING;
chMtxUnlock();
return ret;
}
开发者ID:JarryChou,项目名称:sapog,代码行数:7,代码来源:motor.c
示例20: thread1
static msg_t thread1(void *p) {
chMtxLock(&m1);
test_emit_token(*(char *)p);
chMtxUnlock();
return 0;
}
开发者ID:ColonelPanic42,项目名称:ChibiOS-RPi,代码行数:7,代码来源:testmtx.c
注:本文中的chMtxUnlock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论