Skip to content

Instantly share code, notes, and snippets.

@keesj
Created March 26, 2014 09:54
Show Gist options
  • Save keesj/9779949 to your computer and use it in GitHub Desktop.
Save keesj/9779949 to your computer and use it in GitHub Desktop.
ddekit_thread_t *th =
(ddekit_thread_t *) ddekit_simple_malloc(sizeof(ddekit_thread_t));
memset(th,0,sizeof(ddekit_thread_t));
strncpy(th->name, name, DDEKIT_THREAD_NAMELEN);
th->name[DDEKIT_THREAD_NAMELEN-1] = 0;
th->stack = ddekit_large_malloc(DDEKIT_THREAD_STACKSIZE);
th->arg = arg;
th->fun = fun;
th->id = id++;
th->prio = DDEKIT_THREAD_STDPRIO;
th->next = NULL;
th->sleep_sem = ddekit_sem_init(0);
/* Setup thread context */
//th->ctx.uc_flags |= _UC_IGNSIGM | _UC_IGNFPU;
printf("Address 0x%08\n",&th->ctx);
th->ctx.uc_flags |= _UC_IGNSIGM ;//|_UC_IGNFPU ;
if (getcontext(&th->ctx) != 0) {
panic("ddekit thread create thread getcontext error");
}
printf("magic 0x%08x \n",th->ctx.uc_mcontext.mc_magic);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment