*/
empth_t *empth_self(void);
+/*
+ * Return the name of the current thread.
+ */
+char *empth_name(void);
+
+/*
+ * Sets the name of the current thread.
+ */
+void empth_set_name(char *);
+
/*
* Terminate the current thread.
* The current thread should not be the thread that executed main().
void *lwpGetUD(struct lwpProc * p);
void lwpSetUD(struct lwpProc * p, char *ud);
int lwpSetPriority(int prio);
+char *lwpName(struct lwpProc * p);
+void lwpSetName(struct lwpProc * p, char *name);
struct lwp_rwlock *lwp_rwlock_create(char *);
void lwp_rwlock_destroy(struct lwp_rwlock *);
return LwpCurrent;
}
+char *
+empth_name(void)
+{
+ return lwpName(LwpCurrent);
+}
+
+void
+empth_set_name(char *name)
+{
+ lwpSetName(LwpCurrent, name);
+}
+
void
empth_exit(void)
{
return pThread;
}
+/************************
+ * empth_name
+ */
+char *
+empth_name(void)
+{
+ return empth_self()->szName;
+}
+
+/************************
+ * empth_set_name
+ * Set the thread name
+ */
+void
+empth_set_name(char *name)
+{
+ empth_t *pThread = TlsGetValue(dwTLSIndex);
+
+ strncpy(pThread->szName, name, sizeof(pThread->szName) - 1);
+}
+
/************************
* empth_exit
*/
return pthread_getspecific(ctx_key);
}
+char *
+empth_name(void)
+{
+ return empth_self()->name;
+}
+
+void
+empth_set_name(char *name)
+{
+ empth_t *ctx_ptr;
+
+ ctx_ptr = pthread_getspecific(ctx_key);
+
+ if (ctx_ptr->name != NULL)
+ free(ctx_ptr->name);
+
+ ctx_ptr->name = strdup(name);
+}
+
void
empth_exit(void)
{
lwpStatus(newp, "Thread stack %d used, %d left, %d total",
used, total - used, total);
}
+
+/* lwpName
+ *
+ * Return the name of the thread.
+ */
+char *
+lwpName(struct lwpProc *proc)
+{
+ return proc->name;
+}
+
+/* lwpSetName
+ *
+ * Set the name of the thread.
+ */
+void
+lwpSetName(struct lwpProc *proc, char *name)
+{
+ if (proc->name != NULL)
+ free(proc->name);
+
+ proc->name = strdup(name);
+}
+