(lwpSetDesc): Unused, remove.

[EMPTH_LWP] (lwpProc): Remove member desc.
[EMPTH_LWP] (lwpCreate, lwpDestroy): Don't initialize / finalize it.

[EMPTH_POSIX] (empth_t): Remove member desc.
[EMPTH_POSIX] (empth_init, empth_create): Don't initialize it.

[EMPTH_W32] (loc_Thread): Remove member szDesc.
[EMPTH_W32] (empth_init, empth_create): Don't initialize it.

(empth_create, lwpCreate): Remove parameter desc.  Callers changed.
This commit is contained in:
Markus Armbruster 2007-01-28 16:40:27 +00:00
parent ee46f55e6e
commit d0ab92b944
12 changed files with 33 additions and 67 deletions

View file

@ -61,11 +61,11 @@ empth_init(void **ctx, int flags)
empth_t *
empth_create(int prio, void (*entry)(void *), int size, int flags,
char *name, char *desc, void *ud)
char *name, void *ud)
{
if (!flags)
flags = empth_flags;
return lwpCreate(prio, entry, size, flags, name, desc, 0, 0, ud);
return lwpCreate(prio, entry, size, flags, name, 0, 0, ud);
}
empth_t *

View file

@ -69,8 +69,6 @@ struct loc_Thread {
/* The thread name, passed in at create time. */
char szName[17];
/* The thread description, passed in at create time. */
char szDesc[80];
/* True if this is the main line, and not a real thread. */
BOOL bMainThread;
@ -418,8 +416,6 @@ empth_init(void **ctx_ptr, int flags)
memset(pThread, 0, sizeof(*pThread));
strncpy(pThread->szName, "Main", sizeof(pThread->szName) - 1);
strncpy(pThread->szDesc, "The main process",
sizeof(pThread->szDesc) - 1);
pThread->ulThreadID = GetCurrentThreadId();
pThread->bMainThread = TRUE;
@ -444,29 +440,26 @@ empth_init(void **ctx_ptr, int flags)
* flags - debug control.
* LWP_STACKCHECK - not needed
* name - name of the thread, for debug.
* desc - description of thread, for debug.
* ud - "user data". The "ctx_ptr" gets this value
* when the thread is active.
* It is also passed to the entry function...
*/
empth_t *
empth_create(int prio, void (*entry)(void *), int size, int flags,
char *name, char *desc, void *ud)
char *name, void *ud)
{
empth_t *pThread = NULL;
loc_debug("creating new thread %s:%s", name, desc);
loc_debug("creating new thread %s", name);
pThread = malloc(sizeof(*pThread));
if (!pThread) {
logerror("not enough memory to create thread: %s (%s)",
name, desc);
logerror("not enough memory to create thread %s", name);
return NULL;
}
memset(pThread, 0, sizeof(*pThread));
strncpy(pThread->szName, name, sizeof(pThread->szName) - 1);
strncpy(pThread->szDesc, desc, sizeof(pThread->szDesc) - 1);
pThread->pvUserData = ud;
pThread->pfnEntry = entry;
pThread->bMainThread = FALSE;
@ -479,8 +472,7 @@ empth_create(int prio, void (*entry)(void *), int size, int flags,
pThread->ulThreadID = _beginthread(empth_threadMain, size, pThread);
if (pThread->ulThreadID == -1) {
logerror("can not create thread: %s (%s): %s",
name, desc, strerror(errno));
logerror("can not create thread: %s: %s", name, strerror(errno));
goto bad;
}

View file

@ -61,7 +61,6 @@
struct empth_t {
char *name; /* thread name */
char *desc; /* description */
void *ud; /* user data */
int state; /* my state */
void (*ep)(void *); /* entry point */
@ -177,7 +176,6 @@ empth_init(void **ctx_ptr, int flags)
exit(1);
}
ctx->name = "Main";
ctx->desc = "empire main";
ctx->ep = 0;
ctx->ud = 0;
ctx->id = pthread_self();
@ -197,31 +195,29 @@ empth_init(void **ctx_ptr, int flags)
*/
empth_t *
empth_create(int prio, void (*entry)(void *), int size, int flags,
char *name, char *desc, void *ud)
char *name, void *ud)
{
pthread_t t;
pthread_attr_t attr;
empth_t *ctx;
int eno;
empth_status("creating new thread %s:%s", name, desc);
empth_status("creating new thread %s", name);
ctx = malloc(sizeof(empth_t));
if (!ctx) {
logerror("not enough memory to create thread: %s (%s)",
name, desc);
logerror("not enough memory to create thread %s", name);
return NULL;
}
ctx->name = strdup(name);
ctx->desc = strdup(desc);
ctx->ud = ud;
ctx->state = 0;
ctx->ep = entry;
eno = pthread_attr_init(&attr);
if (eno) {
logerror("can not create thread attribute %s (%s): %s",
name, desc, strerror(eno));
logerror("can not create thread attribute %s: %s",
name, strerror(eno));
goto bad;
}
if (size < PTHREAD_STACK_MIN)
@ -231,8 +227,7 @@ empth_create(int prio, void (*entry)(void *), int size, int flags,
eno = pthread_create(&t, &attr, empth_start, ctx);
if (eno) {
logerror("can not create thread: %s (%s): %s",
name, desc, strerror(eno));
logerror("can not create thread: %s: %s", name, strerror(eno));
goto bad;
}
empth_status("new thread id is %ld", (long)t);