• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ InitOnceExecuteOnce函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中InitOnceExecuteOnce函数的典型用法代码示例。如果您正苦于以下问题:C++ InitOnceExecuteOnce函数的具体用法?C++ InitOnceExecuteOnce怎么用?C++ InitOnceExecuteOnce使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了InitOnceExecuteOnce函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: primitives_get

/* ------------------------------------------------------------------------- */
primitives_t* primitives_get(void)
{
	InitOnceExecuteOnce(&generic_primitives_InitOnce, primitives_init_generic, NULL, NULL);
#if defined(HAVE_OPTIMIZED_PRIMITIVES)
	InitOnceExecuteOnce(&primitives_InitOnce, primitives_init, NULL, NULL);
	return &pPrimitives;
#else
	return &pPrimitivesGeneric;
#endif
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:11,代码来源:primitives.c


示例2: get_notif_hwnd

HWND get_notif_hwnd(void)
{
#ifdef __REACTOS__
    static ATOM wnd_class = 0;
#endif
    tls_data_t *tls_data;

#ifdef __REACTOS__
    static const WCHAR wszURLMonikerNotificationWindow[] =
        {'U','R','L',' ','M','o','n','i','k','e','r',' ',
         'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0};
#else
    static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
#endif

    tls_data = get_tls_data();
    if(!tls_data)
        return NULL;

    if(tls_data->notif_hwnd_cnt) {
        tls_data->notif_hwnd_cnt++;
        return tls_data->notif_hwnd;
    }

#ifndef __REACTOS__
    InitOnceExecuteOnce(&init_once, register_notif_wnd_class, NULL, NULL);
    if(!notif_wnd_class)
        return NULL;
#else
    if(!wnd_class) {
        static WNDCLASSEXW wndclass = {
            sizeof(wndclass), 0,
            notif_wnd_proc, 0, 0,
            NULL, NULL, NULL, NULL, NULL,
            wszURLMonikerNotificationWindow,
            NULL
        };

        wndclass.hInstance = hProxyDll;

        wnd_class = RegisterClassExW(&wndclass);
        if (!wnd_class && GetLastError() == ERROR_CLASS_ALREADY_EXISTS)
            wnd_class = 1;
    }
#endif

#ifndef __REACTOS__
    tls_data->notif_hwnd = CreateWindowExW(0, MAKEINTRESOURCEW(notif_wnd_class),
#else
    tls_data->notif_hwnd = CreateWindowExW(0, wszURLMonikerNotificationWindow,
#endif
            wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE,
            NULL, hProxyDll, NULL);
    if(tls_data->notif_hwnd)
        tls_data->notif_hwnd_cnt++;

    TRACE("hwnd = %p\n", tls_data->notif_hwnd);

    return tls_data->notif_hwnd;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:60,代码来源:bindprot.c


示例3: winpr_CloseThreadpool

VOID winpr_CloseThreadpool(PTP_POOL ptpp)
{
#ifdef _WIN32
	InitOnceExecuteOnce(&init_once_module, init_module, NULL, NULL);
	if (pCloseThreadpool)
	{
		pCloseThreadpool(ptpp);
		return;
	}
#endif
	SetEvent(ptpp->TerminateEvent);

	ArrayList_Free(ptpp->Threads);
	Queue_Free(ptpp->PendingQueue);
	CountdownEvent_Free(ptpp->WorkComplete);
	CloseHandle(ptpp->TerminateEvent);

	if (ptpp == &DEFAULT_POOL)
	{
		ptpp->Threads = NULL;
		ptpp->PendingQueue = NULL;
		ptpp->WorkComplete = NULL;
		ptpp->TerminateEvent = NULL;
	}
	else
	{
		free(ptpp);
	}
}
开发者ID:99455125,项目名称:FreeRDP,代码行数:29,代码来源:pool.c


示例4: tMPI_Thread_once

int tMPI_Thread_once(tMPI_Thread_once_t *once_control, 
                     void (*init_routine)(void))
{
#if 0
    /* use once Vista is minimum required version */
    BOOL bStatus;
    bStatus = InitOnceExecuteOnce(once_control, InitHandleWrapperFunction, 
                                  init_routine, NULL);

    if (!bStatus)
    {
        tMPI_Fatal_error(TMPI_FARGS,"Failed to run thread_once routine");
        return -1;
    }
#else
    /* really ugly hack - and it's slow... */
    tMPI_Init_initers();
    EnterCriticalSection(&once_init);
    if (tMPI_Atomic_get(&(once_control->once)) == 0)
    {
        (*init_routine)();
        tMPI_Atomic_set(&(once_control->once), 1);
    }
    LeaveCriticalSection(&once_init);
#endif
    return 0;
}
开发者ID:chenleo,项目名称:gromacs453pf,代码行数:27,代码来源:winthreads.c


示例5: IsAtMostWindowsVersion

bool IsAtMostWindowsVersion(WindowsVersion version)
{
#ifdef OVR_OS_MS
    if (!InitOnceExecuteOnce(&OSVersionInitOnce, VersionCheckInitOnceCallback, nullptr, nullptr))
    {
        OVR_ASSERT(false);
        return false;
    }

    switch (version)
    {
    case WindowsVersion::Windows10_TH2:
        return (OSVersion < 1000) || (OSVersion == 1000 && OSBuildNumber <= 10586);

    case WindowsVersion::Windows10:
        return (OSVersion < 1000) || (OSVersion == 1000 && OSBuildNumber == 10000);

    case WindowsVersion::Windows8_1:
        return (OSVersion <= 603);

    case WindowsVersion::Windows8:
        return (OSVersion <= 602);

    case WindowsVersion::Windows7_SP1:
        return (OSVersion < 601) || (OSVersion == 601 && OSBuildNumber <= 7601);

    default:
        OVR_ASSERT(false); // Forget to add a case for a new OS?
        return false;
    }
#else // OVR_OS_MS
    OVR_UNUSED(version);
    return false;
#endif // OVR_OS_MS
}
开发者ID:Interaptix,项目名称:OvrvisionPro,代码行数:35,代码来源:Util_SystemInfo.cpp


示例6: winpr_SetThreadpoolThreadMinimum

BOOL winpr_SetThreadpoolThreadMinimum(PTP_POOL ptpp, DWORD cthrdMic)
{
	HANDLE thread;
#ifdef _WIN32
	InitOnceExecuteOnce(&init_once_module, init_module, NULL, NULL);
	if (pSetThreadpoolThreadMinimum)
		return pSetThreadpoolThreadMinimum(ptpp, cthrdMic);
#endif
	ptpp->Minimum = cthrdMic;

	while (ArrayList_Count(ptpp->Threads) < ptpp->Minimum)
	{
		if (!(thread = CreateThread(NULL, 0,
				(LPTHREAD_START_ROUTINE) thread_pool_work_func,
				(void*) ptpp, 0, NULL)))
		{
			return FALSE;
		}

		if (ArrayList_Add(ptpp->Threads, thread) < 0)
			return FALSE;
	}

	return TRUE;
}
开发者ID:99455125,项目名称:FreeRDP,代码行数:25,代码来源:pool.c


示例7: get_notif_hwnd

HWND get_notif_hwnd(void)
{
    tls_data_t *tls_data;

    static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;

    tls_data = get_tls_data();
    if(!tls_data)
        return NULL;

    if(tls_data->notif_hwnd_cnt) {
        tls_data->notif_hwnd_cnt++;
        return tls_data->notif_hwnd;
    }

    InitOnceExecuteOnce(&init_once, register_notif_wnd_class, NULL, NULL);
    if(!notif_wnd_class)
        return NULL;

    tls_data->notif_hwnd = CreateWindowExW(0, MAKEINTRESOURCEW(notif_wnd_class),
            wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE,
            NULL, hProxyDll, NULL);
    if(tls_data->notif_hwnd)
        tls_data->notif_hwnd_cnt++;

    TRACE("hwnd = %p\n", tls_data->notif_hwnd);

    return tls_data->notif_hwnd;
}
开发者ID:Eltechs,项目名称:wine,代码行数:29,代码来源:bindprot.c


示例8: CRYPTO_THREAD_run_once

int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
{
    if (InitOnceExecuteOnce(once, once_cb, init, NULL))
        return 1;

    return 0;
}
开发者ID:Astel,项目名称:openssl,代码行数:7,代码来源:threads_win.c


示例9: sspi_gss_init_sec_context

UINT32 SSPI_GSSAPI sspi_gss_init_sec_context(
    UINT32* minor_status,
    sspi_gss_cred_id_t claimant_cred_handle,
    sspi_gss_ctx_id_t* context_handle,
    sspi_gss_name_t target_name,
    sspi_gss_OID mech_type,
    UINT32 req_flags,
    UINT32 time_req,
    sspi_gss_channel_bindings_t input_chan_bindings,
    sspi_gss_buffer_t input_token,
    sspi_gss_OID* actual_mech_type,
    sspi_gss_buffer_t output_token,
    UINT32* ret_flags,
    UINT32* time_rec)
{
	SECURITY_STATUS status;
	InitOnceExecuteOnce(&g_Initialized, sspi_GssApiInit, NULL, NULL);

	if (!(g_GssApi && g_GssApi->gss_init_sec_context))
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = g_GssApi->gss_init_sec_context(minor_status, claimant_cred_handle, context_handle,
	                                        target_name, mech_type, req_flags, time_req, input_chan_bindings,
	                                        input_token, actual_mech_type, output_token, ret_flags, time_rec);
	WLog_DBG(TAG, "gss_init_sec_context: %s (0x%08"PRIX32")",
	         GetSecurityStatusString(status), status);
	return status;
}
开发者ID:99455125,项目名称:FreeRDP,代码行数:28,代码来源:sspi_gss.c


示例10: sspi_gss_accept_sec_context

UINT32 SSPI_GSSAPI sspi_gss_accept_sec_context(
    UINT32* minor_status,
    sspi_gss_ctx_id_t* context_handle,
    sspi_gss_cred_id_t acceptor_cred_handle,
    sspi_gss_buffer_t input_token_buffer,
    sspi_gss_channel_bindings_t input_chan_bindings,
    sspi_gss_name_t* src_name,
    sspi_gss_OID* mech_type,
    sspi_gss_buffer_t output_token,
    UINT32* ret_flags,
    UINT32* time_rec,
    sspi_gss_cred_id_t* delegated_cred_handle)
{
	SECURITY_STATUS status;
	InitOnceExecuteOnce(&g_Initialized, sspi_GssApiInit, NULL, NULL);

	if (!(g_GssApi && g_GssApi->gss_accept_sec_context))
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = g_GssApi->gss_accept_sec_context(minor_status, context_handle, acceptor_cred_handle,
	         input_token_buffer, input_chan_bindings, src_name, mech_type, output_token,
	         ret_flags, time_rec, delegated_cred_handle);
	WLog_DBG(TAG, "gss_accept_sec_context: %s (0x%08"PRIX32")",
	         GetSecurityStatusString(status), status);
	return status;
}
开发者ID:99455125,项目名称:FreeRDP,代码行数:26,代码来源:sspi_gss.c


示例11: sspi_gss_add_cred

UINT32 SSPI_GSSAPI sspi_gss_add_cred(
    UINT32* minor_status,
    sspi_gss_cred_id_t input_cred_handle,
    sspi_gss_name_t desired_name,
    sspi_gss_OID desired_mech,
    sspi_gss_cred_usage_t cred_usage,
    UINT32 initiator_time_req,
    UINT32 acceptor_time_req,
    sspi_gss_cred_id_t* output_cred_handle,
    sspi_gss_OID_set* actual_mechs,
    UINT32* initiator_time_rec,
    UINT32* acceptor_time_rec)
{
	SECURITY_STATUS status;
	InitOnceExecuteOnce(&g_Initialized, sspi_GssApiInit, NULL, NULL);

	if (!(g_GssApi && g_GssApi->gss_add_cred))
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = g_GssApi->gss_add_cred(minor_status, input_cred_handle, desired_name, desired_mech,
	                                cred_usage,
	                                initiator_time_req, acceptor_time_req, output_cred_handle, actual_mechs, initiator_time_rec,
	                                acceptor_time_rec);
	WLog_DBG(TAG, "gss_add_cred: %s (0x%08"PRIX32")",
	         GetSecurityStatusString(status), status);
	return status;
}
开发者ID:99455125,项目名称:FreeRDP,代码行数:27,代码来源:sspi_gss.c


示例12: global_init

static void
global_init(void)
{
	InitOnceExecuteOnce(&global_init_once,
			    global_init1,
			    nullptr, nullptr);
}
开发者ID:h0rm,项目名称:nomacs-plugins,代码行数:7,代码来源:w2xconv.cpp


示例13: lockEnsureGlobalLock

static void lockEnsureGlobalLock(void)
{
  static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
  BOOL b = InitOnceExecuteOnce(&init_once, lockEnsureGlobalLockCallback,
                               UNUSED_POINTER, NULL);
  AVER(b);
}
开发者ID:Ravenbrook,项目名称:mps,代码行数:7,代码来源:lockw3.c


示例14: ssd

sp_session *SpotifySession::get(abort_callback & p_abort) {
	SpotifySessionData ssd(p_abort, this);
	InitOnceExecuteOnce(&initOnce,
		makeSpotifySession,
		&ssd,
		NULL);
	return getAnyway();
}
开发者ID:FauxFaux,项目名称:foo_input_spotify,代码行数:8,代码来源:SpotifySession.cpp


示例15: FspWin32FromNtStatus

FSP_API DWORD FspWin32FromNtStatus(NTSTATUS Status)
{
    InitOnceExecuteOnce(&FspNtStatusInitOnce, FspNtStatusInitialize, 0, 0);
    if (0 == FspRtlNtStatusToDosError)
        return ERROR_MR_MID_NOT_FOUND;

    return FspRtlNtStatusToDosError(Status);
}
开发者ID:os12,项目名称:winfsp,代码行数:8,代码来源:ntstatus.c


示例16: Shell_GetImageLists

/*************************************************************************
 * Shell_GetImageLists			[SHELL32.71]
 *
 * PARAMETERS
 *  imglist[1|2] [OUT] pointer which receives imagelist handles
 *
 */
BOOL WINAPI Shell_GetImageLists(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList)
{
    TRACE("(%p,%p)\n",lpBigList,lpSmallList);
    InitOnceExecuteOnce( &sic_init_once, SIC_Initialize, NULL, NULL );
    if (lpBigList) *lpBigList = ShellBigIconList;
    if (lpSmallList) *lpSmallList = ShellSmallIconList;
    return TRUE;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:15,代码来源:iconcache.c


示例17: _NtClose

NTSTATUS _NtClose(HANDLE Handle)
{
	InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);

	if (!pNtClose)
		return STATUS_INTERNAL_ERROR;

	return pNtClose(Handle);
}
开发者ID:abma,项目名称:FreeRDP,代码行数:9,代码来源:nt.c


示例18: _RtlFreeUnicodeString

VOID _RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
{
	InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);

	if (!pRtlFreeUnicodeString)
		return;

	pRtlFreeUnicodeString(UnicodeString);
}
开发者ID:abma,项目名称:FreeRDP,代码行数:9,代码来源:nt.c


示例19: _RtlInitAnsiString

VOID _RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
{
	InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);

	if (!pRtlInitAnsiString)
		return;

	pRtlInitAnsiString(DestinationString, SourceString);
}
开发者ID:abma,项目名称:FreeRDP,代码行数:9,代码来源:nt.c


示例20: _RtlInitUnicodeString

VOID _RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
{
	InitOnceExecuteOnce(&ntdllInitOnce, NtdllModuleInit, NULL, NULL);

	if (!pRtlInitUnicodeString)
		return;

	pRtlInitUnicodeString(DestinationString, SourceString);
}
开发者ID:abma,项目名称:FreeRDP,代码行数:9,代码来源:nt.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ InitOpenGL函数代码示例发布时间:2022-05-30
下一篇:
C++ InitMovementInfoForBase函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap