本文整理汇总了C++中SingletonPtr类的典型用法代码示例。如果您正苦于以下问题:C++ SingletonPtr类的具体用法?C++ SingletonPtr怎么用?C++ SingletonPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SingletonPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: platform_timer_enable
// Called once at boot
void platform_timer_enable(void)
{
#if !MBED_CONF_NANOSTACK_HAL_CRITICAL_SECTION_USABLE_FROM_INTERRUPT
equeue = mbed_highprio_event_queue();
MBED_ASSERT(equeue != NULL);
#endif
timer->start();
// Prime the SingletonPtr - can't construct from IRQ/critical section
timeout.get();
}
示例2: 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;
}
示例3: 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();
}
示例4: 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();
}
示例5: 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();
}
示例6: 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 );
}
示例7: platform_fhss_timer_start
static int platform_fhss_timer_start(uint32_t slots, void (*callback)(const fhss_api_t *api, uint16_t), const fhss_api_t *callback_param)
{
int ret_val = -1;
platform_enter_critical();
if (timer_initialized == false) {
#if !MBED_CONF_NANOSTACK_HAL_CRITICAL_SECTION_USABLE_FROM_INTERRUPT
equeue = mbed_highprio_event_queue();
MBED_ASSERT(equeue != NULL);
#endif
timer->start();
timer_initialized = true;
}
fhss_timeout_s *fhss_tim = find_timeout(callback);
if (!fhss_tim) {
fhss_tim = allocate_timeout();
}
if (!fhss_tim) {
platform_exit_critical();
tr_error("Failed to allocate timeout");
return ret_val;
}
fhss_tim->fhss_timer_callback = callback;
fhss_tim->start_time = read_current_time();
fhss_tim->stop_time = fhss_tim->start_time + slots;
fhss_tim->active = true;
fhss_tim->timeout->attach_us(timer_callback, slots);
fhss_active_handle = callback_param;
ret_val = 0;
platform_exit_critical();
return ret_val;
}
示例8: platform_timer_get_remaining_slots
// This is called from inside platform_enter_critical - IRQs can't happen
uint16_t platform_timer_get_remaining_slots(void)
{
uint32_t elapsed = timer->read_us();
if (elapsed < due) {
return (uint16_t) ((due - elapsed) / 50);
} else {
return 0;
}
}
示例9: 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;
}
示例10: mbed_mem_trace_unlock
void mbed_mem_trace_unlock()
{
trace_lock_count--;
mem_trace_mutex->unlock();
}
示例11: _rtc_lpticker_init
static void _rtc_lpticker_init(void)
{
_rtc_lp_timer->start();
_rtc_enabled = true;
}
示例12: _rtc_lpticker_read
static time_t _rtc_lpticker_read(void)
{
return (uint64_t)_rtc_lp_timer->read() + _rtc_lp_base;
}
示例13:
static uint32_t read_current_time(void)
{
return timer->read_us();
}
示例14: platform_timer_start
// This is called from inside platform_enter_critical - IRQs can't happen
void platform_timer_start(uint16_t slots)
{
timer->reset();
due = slots * UINT32_C(50);
timeout->attach_us(timer_callback, due);
}
示例15: unlock
void FATFileSystem::unlock()
{
_ffs_mutex->unlock();
}