Example #1
0
deltamap_t* ponyint_actormap_sweep(pony_ctx_t* ctx, actormap_t* map,
  uint32_t mark, deltamap_t* delta)
{
  size_t i = HASHMAP_BEGIN;
  actorref_t* aref;
  bool needs_optimize = false;

  while((aref = ponyint_actormap_next(map, &i)) != NULL)
  {
    if(aref->mark == mark)
    {
      aref = move_unmarked_objects(aref, mark);
    } else {
      ponyint_actormap_clearindex(map, i);
      delta = ponyint_deltamap_update(delta, aref->actor, 0);
      needs_optimize = true;
    }

    send_release(ctx, aref);
  }

  if(needs_optimize)
    ponyint_actormap_optimize(map);

  return delta;
}
Example #2
0
void ponyint_gc_sendrelease_manual(pony_ctx_t* ctx)
{
  size_t i = HASHMAP_BEGIN;
  actorref_t* aref;

  while((aref = ponyint_actormap_next(&ctx->acquire, &i)) != NULL)
  {
    ponyint_actormap_clearindex(&ctx->acquire, i);
    pony_sendp(ctx, aref->actor, ACTORMSG_RELEASE, aref);
  }

  pony_assert(ponyint_actormap_size(&ctx->acquire) == 0);
}
Example #3
0
File: gc.c Project: cyisfor/ponyc
void ponyint_gc_sendacquire(pony_ctx_t* ctx)
{
  size_t i = HASHMAP_BEGIN;
  actorref_t* aref;

  while((aref = ponyint_actormap_next(&ctx->acquire, &i)) != NULL)
  {
    ponyint_actormap_removeindex(&ctx->acquire, i);
    pony_sendp(ctx, aref->actor, ACTORMSG_ACQUIRE, aref);
  }

  ponyint_actormap_destroy(&ctx->acquire);
  memset(&ctx->acquire, 0, sizeof(actormap_t));
}