예제 #1
0
static __itt_string_handle* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_createW),_init))(const wchar_t* name)
{
    __itt_string_handle *h_tail = NULL, *h = NULL;

    if (name == NULL)
    {
        return NULL;
    }

    ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global));
    if (_N_(_ittapi_global).api_initialized)
    {
        if (ITTNOTIFY_NAME(string_handle_createW) && ITTNOTIFY_NAME(string_handle_createW) != ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_createW),_init)))
        {
            __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
            return ITTNOTIFY_NAME(string_handle_createW)(name);
        }
    }
    for (h_tail = NULL, h = _N_(_ittapi_global).string_list; h != NULL; h_tail = h, h = h->next)
    {
        if (h->strW != NULL && !wcscmp(h->strW, name)) break;
    }
    if (h == NULL) 
    {
        NEW_STRING_HANDLE_W(&_N_(_ittapi_global),h,h_tail,name);
    }
    __itt_mutex_unlock(&_N_(_ittapi_global).mutex);
    return h;
}
예제 #2
0
static __itt_string_handle* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_createW),_init))(const wchar_t* name)
{
    __itt_string_handle *h_tail, *h;

    if (!__itt_ittapi_global.api_initialized && __itt_ittapi_global.thread_list->tid == 0)
    {
        __itt_init_ittlib_name(NULL, __itt_group_all);
        if (ITTNOTIFY_NAME(string_handle_createW) && ITTNOTIFY_NAME(string_handle_createW) != ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_createW),_init)))
            return ITTNOTIFY_NAME(string_handle_createW)(name);
    }

    if (name == NULL)
        return __itt_ittapi_global.string_list;

    ITT_MUTEX_INIT_AND_LOCK(__itt_ittapi_global);
    for (h_tail = NULL, h = __itt_ittapi_global.string_list; h != NULL; h_tail = h, h = h->next)
        if (h->strW != NULL && !wcscmp(h->strW, name))
            break;
    if (h == NULL) {
        NEW_STRING_HANDLE_W(&__itt_ittapi_global,h,h_tail,name);
    }
    __itt_mutex_unlock(&__itt_ittapi_global.mutex);
    return h;
}