(lwpProc, lwpSem): Declare as incomplete type in include/lwp.h. Move
complete declaration to src/lib/lwp/lwpint.h. (lwpQueue): Move to src/lib/lwp/lwpint.h. (empth_main, empth_flags): New. (empth_init): Initialize them. (empth_create, empth_exit): Use them instead of lwpProc members.
This commit is contained in:
parent
f958d3d683
commit
aab54fcd54
4 changed files with 52 additions and 41 deletions
|
@ -37,10 +37,18 @@
|
|||
|
||||
#ifdef _EMPTH_LWP
|
||||
|
||||
/* The thread `created' by lwpInitSystem() */
|
||||
static empth_t *empth_main;
|
||||
|
||||
/* Flags that were passed to empth_init() */
|
||||
static int empth_flags;
|
||||
|
||||
|
||||
int
|
||||
empth_init(void **ctx, int flags)
|
||||
{
|
||||
lwpInitSystem(PP_MAIN, (char **)ctx, flags);
|
||||
empth_flags = flags;
|
||||
empth_main = lwpInitSystem(PP_MAIN, (char **)ctx, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -49,9 +57,8 @@ empth_t *
|
|||
empth_create(int prio, void (*entry)(void *), int size, int flags,
|
||||
char *name, char *desc, void *ud)
|
||||
{
|
||||
/* inherit flags */
|
||||
if (!flags)
|
||||
flags = LwpCurrent->flags;
|
||||
flags = empth_flags;
|
||||
return lwpCreate(prio, entry, size, flags, name, desc, 0, 0, ud);
|
||||
}
|
||||
|
||||
|
@ -68,7 +75,7 @@ empth_exit(void)
|
|||
|
||||
/* We want to leave the main thread around forever, until it's time
|
||||
for it to die for real (in a shutdown) */
|
||||
if (!strcmp(LwpCurrent->name, "Main")) {
|
||||
if (LwpCurrent == empth_main) {
|
||||
while (1) {
|
||||
time(&now);
|
||||
lwpSleepUntil(now + 60);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue