view paper/src/pickupAfter.cbc @ 111:4642d2f215d2

update
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sat, 06 Feb 2021 15:42:26 +0900
parents 63801f42ade3
children
line wrap: on
line source

__code pickup_lforkPhilsImpl(struct Context *context,struct PhilsImpl* phils, enum Code next) {
    struct AtomicT_int* left_fork = phils->Leftfork;
    Gearef(context, AtomicT_int)->atomicT_int = (union Data*) left_fork;
    Gearef(context, AtomicT_int)->oldData = -1;
    Gearef(context, AtomicT_int)->newData = phils->self;
    Gearef(context, AtomicT_int)->next = C_pickup_rforkPhilsImpl;
    Gearef(context, AtomicT_int)->fail = C_eatingPhilsImpl;
    goto meta(context, left_fork->checkAndSet);

}

__code pickup_lforkPhilsImpl_stub(struct Context* context) {
  PhilsImpl* phils = (PhilsImpl*)GearImpl(context, Phils, phils);
  enum Code next = Gearef(context, Phils)->next;
  goto pickup_lforkPhilsImpl(context, phils, next);
}

__code eatingPhilsImpl(struct Context *context,struct PhilsImpl* phils, enum Code next) {
    printf("%d: eating\n", phils->self);
    goto meta(context, C_putdown_rforkPhilsImpl);
}

__code eatingPhilsImpl_stub(struct Context* context) {
  PhilsImpl* phils = (PhilsImpl*)GearImpl(context, Phils, phils);
  enum Code next = Gearef(context, Phils)->next;
  goto eatingPhilsImpl(context, phils, next);
}