|
|
1.1 ! root 1: #include "task.h" ! 2: ! 3: object.~object() ! 4: { ! 5: if (o_link) task_error(E_OLINK,this); ! 6: if (o_next) task_error(E_ONEXT,this); ! 7: } /* delete */ ! 8: ! 9: /* note that a task can be on a chain in several places ! 10: */ ! 11: ! 12: /* object.remember() ... */ ! 13: ! 14: void object.forget(register task* p) ! 15: /* remove all occurrences of task* p from this object's task list */ ! 16: { ! 17: register olink* ll; ! 18: register olink* l; ! 19: ! 20: if (o_link == 0) return; ! 21: ! 22: while (o_link->l_task == p) { ! 23: ll = o_link; ! 24: o_link = ll->l_next; ! 25: delete ll; ! 26: if (o_link == 0) return; ! 27: }; ! 28: ! 29: l = o_link; ! 30: while (ll = l->l_next) { ! 31: if (ll->l_task == p) { ! 32: l->l_next = ll->l_next; ! 33: delete ll; ! 34: } ! 35: else l = ll; ! 36: }; ! 37: } ! 38: ! 39: ! 40: void object.alert() ! 41: /* prepare IDLE tasks on this object for sceduling */ ! 42: { ! 43: register olink* l; ! 44: ! 45: for (l=o_link; l; l=l->l_next) { ! 46: register task* p = l->l_task; ! 47: if (p->s_state == IDLE) p->insert(0,this); ! 48: } ! 49: } ! 50: ! 51: void object.print(int n) ! 52: { ! 53: int m = n & ~CHAIN; ! 54: ! 55: switch (o_type) { ! 56: case QHEAD: ! 57: ((qhead*) this)->print(m); ! 58: break; ! 59: case QTAIL: ! 60: ((qtail*) this)->print(m); ! 61: break; ! 62: case TASK: ! 63: ((task*) this)->print(m); ! 64: break; ! 65: case TIMER: ! 66: ((task*) this)->print(m); ! 67: break; ! 68: default: ! 69: printf("object (o_type==%d): ",o_type); ! 70: } ! 71: ! 72: if (n&VERBOSE) { ! 73: olink* l; ! 74: printf("remember_chain:\n"); ! 75: for (l=o_link; l; l=l->l_next) l->l_task->print(m); ! 76: } ! 77: ! 78: if (n&CHAIN) { ! 79: if (o_next) o_next->print(n); ! 80: } ! 81: printf("\n"); ! 82: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.