コード例 #1
0
ファイル: YatePhone.cpp プロジェクト: vir/YateComServer
	static MyClientLogic& CheckInstance()
	{
		s_mutex.lock();
		static MyClientLogic instance;
		MyClientLogic& r = instance;
		s_mutex.unlock();
		return r;
	}
コード例 #2
0
ファイル: TelEngine.cpp プロジェクト: hewu2008/yate
static int _localtime_s(struct tm* _tm, const time_t* time)
{
    static TelEngine::Mutex m(false,"_localtime_s");
    struct tm* tmp;
    if (!_tm)
        return EINVAL;
    _tm->tm_isdst = _tm->tm_yday = _tm->tm_wday = _tm->tm_year = _tm->tm_mon = _tm->tm_mday =
                                       _tm->tm_hour = _tm->tm_min = _tm->tm_sec = -1;
    if (!time)
        return EINVAL;
    m.lock();
    tmp = localtime(time);
    if (!tmp) {
        m.unlock();
        return EINVAL;
    }
    *_tm = *tmp;
    m.unlock();
    return 0;
}