Make empth_name() and empth_set_name() take a thread argument
This commit is contained in:
parent
7581b50eb6
commit
d46b0b727d
6 changed files with 20 additions and 26 deletions
|
@ -75,15 +75,15 @@ empth_self(void)
|
|||
}
|
||||
|
||||
char *
|
||||
empth_name(void)
|
||||
empth_name(empth_t *thread)
|
||||
{
|
||||
return lwpName(LwpCurrent);
|
||||
return lwpName(thread);
|
||||
}
|
||||
|
||||
void
|
||||
empth_set_name(char *name)
|
||||
empth_set_name(empth_t *thread, char *name)
|
||||
{
|
||||
lwpSetName(LwpCurrent, name);
|
||||
lwpSetName(thread, name);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -490,9 +490,9 @@ empth_self(void)
|
|||
* empth_name
|
||||
*/
|
||||
char *
|
||||
empth_name(void)
|
||||
empth_name(empth_t *thread)
|
||||
{
|
||||
return empth_self()->szName;
|
||||
return thread->szName;
|
||||
}
|
||||
|
||||
/************************
|
||||
|
@ -500,11 +500,9 @@ empth_name(void)
|
|||
* Set the thread name
|
||||
*/
|
||||
void
|
||||
empth_set_name(char *name)
|
||||
empth_set_name(empth_t *thread, char *name)
|
||||
{
|
||||
empth_t *pThread = TlsGetValue(dwTLSIndex);
|
||||
|
||||
strncpy(pThread->szName, name, sizeof(pThread->szName) - 1);
|
||||
strncpy(thread->szName, name, sizeof(thread->szName) - 1);
|
||||
}
|
||||
|
||||
/************************
|
||||
|
|
|
@ -248,22 +248,17 @@ empth_self(void)
|
|||
}
|
||||
|
||||
char *
|
||||
empth_name(void)
|
||||
empth_name(empth_t *thread)
|
||||
{
|
||||
return empth_self()->name;
|
||||
return thread->name;
|
||||
}
|
||||
|
||||
void
|
||||
empth_set_name(char *name)
|
||||
empth_set_name(empth_t *thread, char *name)
|
||||
{
|
||||
empth_t *ctx_ptr;
|
||||
|
||||
ctx_ptr = pthread_getspecific(ctx_key);
|
||||
|
||||
if (ctx_ptr->name != NULL)
|
||||
if (thread->name)
|
||||
free(ctx_ptr->name);
|
||||
|
||||
ctx_ptr->name = strdup(name);
|
||||
thread->name = strdup(name);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue