diff --git a/inc/mthread/mthread.h b/inc/mthread/mthread.h index e3184b88180823895170b9940aee453c6cc2e51c..a370405b848ae246c081f565d25e1bd97e5b61bd 100644 --- a/inc/mthread/mthread.h +++ b/inc/mthread/mthread.h @@ -106,3 +106,4 @@ void mthread_yield(); /* Initialize mthread. */ void mthread_init(); +void *mthread_main(void *arg); diff --git a/src/main/server.c b/src/main/server.c index 3c12393aae955f437550038bf0100c1972d3d929..434784e236c647b1bed0f592bff44b040160470e 100644 --- a/src/main/server.c +++ b/src/main/server.c @@ -11,6 +11,7 @@ #include <string.h> #include <strings.h> #include <pwd.h> +#include <pthread.h> /* Prints the help of the program */ static void @@ -37,10 +38,9 @@ print_help(void) int main(int argc, char *argv[]) { - /* Variable initialisation */ struct passwd *pw = getpwuid(getuid()); + pthread_t th; - /* Argument handleing */ if (argc <= 1) goto normal_launch; else if (strcasecmp(argv[1], "--help") == 0 || @@ -58,6 +58,6 @@ main(int argc, char *argv[]) normal_launch: LOG_INFO("Lektor launched by user %s (shell: %s, home: %s)", pw->pw_name, pw->pw_shell, pw->pw_dir); mthread_init(); - + pthread_create(&th, NULL, mthread_main, NULL); return lkt_listen(); } diff --git a/src/mthread/mthread.c b/src/mthread/mthread.c index 47fff88c85c388168c910d3ae3025d5959d91043..07d6918fea21753b6e871dab8c27600021223e53 100644 --- a/src/mthread/mthread.c +++ b/src/mthread/mthread.c @@ -133,7 +133,6 @@ __mthread_yield(mthread_virtual_processor_t *vp) struct mthread_s *next = mthread_remove_first(&(vp->ready_list)); if (vp->resched != NULL) { - LOG_INFO_SCT("SCHEDULER", "Insert %p in ready list of %d", (void *) vp->resched, vp->rank); mthread_insert_last((struct mthread_s *)vp->resched, &(vp->ready_list)); vp->resched = NULL; } @@ -151,9 +150,9 @@ __mthread_yield(mthread_virtual_processor_t *vp) next = vp->idle; } - if (next != NULL) { /* always true at this point - except for idle thread */ + /* always true at this point - except for idle thread */ + if (next != NULL) { if (vp->current != next) { - LOG_INFO_SCT("SCHEDULER", "Swap from %p to %p", (void *) current, (void *) next); vp->current = next; mthread_mctx_swap(current, next); } @@ -213,7 +212,7 @@ mthread_init_vp(mthread_virtual_processor_t *vp, struct mthread_s *idle, vp->p = NULL; } -static inline void * +void * mthread_main(void *arg) { (void)arg;