struct loc_Thread {
/* The thread name, passed in at create time. */
- char szName[17];
+ char *szName;
/* True if this is the main line, and not a real thread. */
BOOL bMainThread;
if (pThread) {
if (pThread->hThreadEvent)
CloseHandle(pThread->hThreadEvent);
+ if (pThread->szName != NULL)
+ free(pThread->szName);
memset(pThread, 0, sizeof(*pThread));
free(pThread);
}
}
memset(pThread, 0, sizeof(*pThread));
- strncpy(pThread->szName, "Main", sizeof(pThread->szName) - 1);
+ pThread->szName = strdup("Main");
pThread->ulThreadID = GetCurrentThreadId();
pThread->bMainThread = TRUE;
}
memset(pThread, 0, sizeof(*pThread));
- strncpy(pThread->szName, name, sizeof(pThread->szName) - 1);
+ pThread->szName = strdup(name);
pThread->pvUserData = ud;
pThread->pfnEntry = entry;
pThread->bMainThread = FALSE;
void
empth_set_name(empth_t *thread, char *name)
{
- strncpy(thread->szName, name, sizeof(thread->szName) - 1);
+ if (thread->szName != NULL)
+ free(thread->szName);
+ thread->szName = strdup(name);
}
/************************