Beispiel #1
0
Datei: task.c Projekt: 8l/sol
STask* STaskCreate(SFunc* func, STask* supt, STaskFlag flags) {
  STask* t = (STask*)malloc(sizeof(STask)); // TODO: malloc

  // Scheduler doubly-linked list links
  t->next = 0;
  t->prev = 0;

  // Entry activation record
  t->ar = SARecCreate(func, 0);

  // Set parent task, initialize refcount and STORE flags
  t->supt = supt;
  t->refc = 1; // 1 is our "live" refcount which is decremented when we end
  t->flags = flags;

  // waiting for nothing
  t->wp = 0;
  t->wtype = 0;

  // Initialize inbox
  t->inbox = S_MSGQ_INIT(t->inbox);

  return t;
}
Beispiel #2
0
STask* STaskCreate(SFunc* func) {
  STask* t = (STask*)malloc(sizeof(STask));
  t->next = 0;
  t->ar = SARecCreate(func, 0);
  return t;
}