当前位置: 首页>>代码示例>>C++>>正文


C++ SingletonPtr类代码示例

本文整理汇总了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();
}
开发者ID:janjongboom,项目名称:mbed-simulator,代码行数:11,代码来源:arm_hal_timer.cpp

示例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;
}
开发者ID:SolarTeamEindhoven,项目名称:mbed,代码行数:7,代码来源:mbed_rtc_time.cpp

示例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();
}
开发者ID:sg-,项目名称:mbed-os,代码行数:8,代码来源:mbed_rtc_time.cpp

示例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();
}
开发者ID:sg-,项目名称:mbed-os,代码行数:10,代码来源:mbed_rtc_time.cpp

示例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();
}
开发者ID:donatieng,项目名称:mbed,代码行数:12,代码来源:platform_alt.cpp

示例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 );
}
开发者ID:donatieng,项目名称:mbed,代码行数:14,代码来源:platform_alt.cpp

示例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;
}
开发者ID:donatieng,项目名称:mbed,代码行数:31,代码来源:arm_hal_fhss_timer.cpp

示例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;
    }
}
开发者ID:janjongboom,项目名称:mbed-simulator,代码行数:10,代码来源:arm_hal_timer.cpp

示例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;
}
开发者ID:sg-,项目名称:mbed-os,代码行数:22,代码来源:mbed_rtc_time.cpp

示例10: mbed_mem_trace_unlock

void mbed_mem_trace_unlock()
{
    trace_lock_count--;
    mem_trace_mutex->unlock();
}
开发者ID:Archcady,项目名称:mbed-os,代码行数:5,代码来源:mbed_mem_trace.cpp

示例11: _rtc_lpticker_init

static void _rtc_lpticker_init(void)
{
    _rtc_lp_timer->start();
    _rtc_enabled = true;
}
开发者ID:sg-,项目名称:mbed-os,代码行数:5,代码来源:mbed_rtc_time.cpp

示例12: _rtc_lpticker_read

static time_t _rtc_lpticker_read(void)
{
    return (uint64_t)_rtc_lp_timer->read() + _rtc_lp_base;
}
开发者ID:sg-,项目名称:mbed-os,代码行数:4,代码来源:mbed_rtc_time.cpp

示例13:

static uint32_t read_current_time(void)
{
    return timer->read_us();
}
开发者ID:donatieng,项目名称:mbed,代码行数:4,代码来源:arm_hal_fhss_timer.cpp

示例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);
}
开发者ID:janjongboom,项目名称:mbed-simulator,代码行数:7,代码来源:arm_hal_timer.cpp

示例15: unlock

void FATFileSystem::unlock()
{
    _ffs_mutex->unlock();
}
开发者ID:OpenNuvoton,项目名称:mbed,代码行数:4,代码来源:FATFileSystem.cpp


注:本文中的SingletonPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。