withDevices :: MTaskDevice (MTaskDevice -> MTaskDevice) -> Task ()
deviceTaskDelete :: MTaskDevice MTaskTask -> Task ()
-deviceTaskAcked :: MTaskDevice Int -> Task ()
+deviceTaskAcked :: MTaskDevice Int Int -> Task ()
deviceTaskDeleteAcked :: MTaskDevice Int -> Task ()
deviceAddSpec :: MTaskDevice MTaskDeviceSpec -> Task ()
withDevices :: MTaskDevice (MTaskDevice -> MTaskDevice) -> Task ()
withDevices a trans = upd (map \b->if (b == a) (trans b) b) deviceStore @! ()
-deviceTaskAcked :: MTaskDevice Int -> Task ()
-deviceTaskAcked dev i
- = withDevices dev (\d->{d&deviceTasks=ackFirst d.deviceTasks})
+deviceTaskAcked :: MTaskDevice Int Int -> Task ()
+deviceTaskAcked dev i mem
+ = withDevices dev (\d->{d
+ &deviceTasks=ackFirst d.deviceTasks
+ ,deviceSpec=Just {fromJust d.deviceSpec & bytesMemory=mem}})
where
ackFirst :: [MTaskTask] -> [MTaskTask]
ackFirst [] = []
debug("Received a task of length %d", t->tasklength);
t->lastrun = 0L;
t->taskid = taskid++;
+ t->value = 0;
write_byte('t');
write16(t->taskid);
+ write16(mem_free());
write_byte('\n');
debug("free memory: %lu\n", mem_free());
}
uint8_t taskid;
struct task *next;
uint8_t *bc;
+ int value;
};
bool is_interrupt_task(struct task* t);
from Generics.gCons import class gCons, generic conses, generic consName, generic consIndex, generic consNum
:: MTaskMSGRecv
- = MTTaskAck Int
+ = MTTaskAck Int Int
| MTTaskDelAck Int
| MTSDSAck Int
| MTSDSDelAck Int
| not (trace_tn ("decoding: " +++ toString (toJSON x))) = undef
| size x == 0 = MTEmpty
= case x.[0] of
- 't' = MTTaskAck $ fromByteCode x
+ 't' = MTTaskAck (fromByteCode x) (fromByteCode (x % (2, size x)))
'd' = MTTaskDelAck $ fromByteCode x
'm' = MTMessage x
's' = MTSDSAck $ fromByteCode x
+++ " value " +++ safePrint v
instance toString MTaskMSGRecv where
- toString (MTTaskAck i) = "Task added with id: " +++ toString i
+ toString (MTTaskAck i mem) = "Task added with id: " +++ toString i
+ +++ " free memory: " +++ toString mem
toString (MTTaskDelAck i) = "Task deleted with id: " +++ toString i
toString (MTSDSAck i) = "SDS added with id: " +++ toString i
toString (MTSDSDelAck i) = "SDS deleted with id: " +++ toString i
// MTSDSAck i = traceValue (toString m) @! ()
// MTSDSDelAck i = traceValue (toString m) @! ()
MTPub i val = updateShare i val
- MTTaskAck i = deviceTaskAcked device i
+ MTTaskAck i mem = deviceTaskAcked device i mem
MTTaskDelAck i = deviceTaskDeleteAcked device i @! ()
MTDevSpec s = deviceAddSpec device s @! ()
_ = treturn ()