本文整理汇总了C++中SingletonPtr::unlock方法的典型用法代码示例。如果您正苦于以下问题:C++ SingletonPtr::unlock方法的具体用法?C++ SingletonPtr::unlock怎么用?C++ SingletonPtr::unlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SingletonPtr
的用法示例。
在下文中一共展示了SingletonPtr::unlock方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clock
clock_t clock() {
_mutex->lock();
clock_t t = us_ticker_read();
t /= 1000000 / CLOCKS_PER_SEC; // convert to processor time
_mutex->unlock();
return t;
}
示例2: attach_rtc
void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void)) {
_mutex->lock();
_rtc_read = read_rtc;
_rtc_write = write_rtc;
_rtc_init = init_rtc;
_rtc_isenabled = isenabled_rtc;
_mutex->unlock();
}
示例3: set_time
void set_time(time_t t) {
_mutex->lock();
if (_rtc_init != NULL) {
_rtc_init();
}
if (_rtc_write != NULL) {
_rtc_write(t);
}
_mutex->unlock();
}
示例4: mbedtls_platform_teardown
void mbedtls_platform_teardown( mbedtls_platform_context *unused_ctx )
{
mbedtls_mutex->lock();
--plat_ctx.reference_count;
if( plat_ctx.reference_count < 1 )
{
/* call platform specific code to terminate crypto driver */
crypto_platform_terminate( &plat_ctx.platform_impl_ctx );
plat_ctx.reference_count = 0;
}
mbedtls_mutex->unlock();
}
示例5: mbedtls_platform_setup
int mbedtls_platform_setup( mbedtls_platform_context *unused_ctx )
{
int ret = 0;
mbedtls_mutex->lock();
++plat_ctx.reference_count;
if( plat_ctx.reference_count == 1 )
{
/* call platform specific code to setup crypto driver */
ret = crypto_platform_setup( &plat_ctx.platform_impl_ctx );
}
mbedtls_mutex->unlock();
return ( ret );
}
示例6: time
time_t time(time_t *timer)
#endif
{
_mutex->lock();
if (_rtc_isenabled != NULL) {
if (!(_rtc_isenabled())) {
set_time(0);
}
}
time_t t = (time_t)-1;
if (_rtc_read != NULL) {
t = _rtc_read();
}
if (timer != NULL) {
*timer = t;
}
_mutex->unlock();
return t;
}
示例7: unlock
void FATFileSystem::unlock()
{
_ffs_mutex->unlock();
}
示例8: basic_erase_program_read_test
// Mutex is protecting rand() per srand for buffer writing and verification.
// Mutex is also protecting printouts for clear logs.
// Mutex is NOT protecting Block Device actions: erase/program/read - which is the purpose of the multithreaded test!
void basic_erase_program_read_test(BlockDevice *block_device, bd_size_t block_size, uint8_t *write_block,
uint8_t *read_block, unsigned addrwidth, int thread_num)
{
int err = 0;
_mutex->lock();
// Make sure block address per each test is unique
static unsigned block_seed = 1;
srand(block_seed++);
// Find a random block
int threaded_rand_number = (rand() * TEST_NUM_OF_THREADS) + thread_num;
bd_addr_t block = (threaded_rand_number * block_size) % block_device->size();
// Flashiap boards with inconsistent sector size will not align with random start addresses
if (bd_arr[test_iteration] == flashiap) {
block = 0;
}
// Use next random number as temporary seed to keep
// the address progressing in the pseudorandom sequence
unsigned seed = rand();
// Fill with random sequence
srand(seed);
for (bd_size_t i_ind = 0; i_ind < block_size; i_ind++) {
write_block[i_ind] = 0xff & rand();
}
// Write, sync, and read the block
utest_printf("test %0*llx:%llu...\n", addrwidth, block, block_size);
// Thread test for flashiap write to the same sector, so all write/read/erase actions should be locked
if (bd_arr[test_iteration] != flashiap) {
_mutex->unlock();
}
err = block_device->erase(block, block_size);
TEST_ASSERT_EQUAL(0, err);
err = block_device->program(write_block, block, block_size);
TEST_ASSERT_EQUAL(0, err);
err = block_device->read(read_block, block, block_size);
TEST_ASSERT_EQUAL(0, err);
if (bd_arr[test_iteration] != flashiap) {
_mutex->lock();
}
// Check that the data was unmodified
srand(seed);
int val_rand;
for (bd_size_t i_ind = 0; i_ind < block_size; i_ind++) {
val_rand = rand();
if ((0xff & val_rand) != read_block[i_ind]) {
utest_printf("\n Assert Failed Buf Read - block:size: %llx:%llu \n", block, block_size);
utest_printf("\n pos: %llu, exp: %02x, act: %02x, wrt: %02x \n", i_ind, (0xff & val_rand),
read_block[i_ind],
write_block[i_ind]);
}
TEST_ASSERT_EQUAL(0xff & val_rand, read_block[i_ind]);
}
_mutex->unlock();
}
示例9: mbed_mem_trace_unlock
void mbed_mem_trace_unlock()
{
trace_lock_count--;
mem_trace_mutex->unlock();
}