Пример #1
0
int main(int argc, char **argv)
{
  test_t *tst;
  if (argc > 1)
    srand(atoi(argv[1]));

  thrd = stacklet_newthread();
  for (tst=test_list; tst->runtest; tst++)
    {
      printf("+++ Running %s... +++\n", tst->name);
      tst->runtest();
    }
  stacklet_deletethread(thrd);
  printf("+++ All ok. +++\n");
  return 0;
}
Пример #2
0
static void
Fiber_tp_dealloc(Fiber *self)
{
    if (self->stacklet_h != NULL && self->stacklet_h != EMPTY_STACKLET_HANDLE) {
        stacklet_destroy(self->stacklet_h);
        self->stacklet_h = NULL;
    }
    if (self->is_main) {
        stacklet_deletethread(self->thread_h);
        self->thread_h = NULL;
    }
    if (self->weakreflist != NULL) {
        PyObject_ClearWeakRefs((PyObject *)self);
    }
    Py_TYPE(self)->tp_clear((PyObject *)self);
    Py_TYPE(self)->tp_free((PyObject *)self);
}