OVMS# module tasksNumber of Tasks = 17 Stack: Now Max Total Heap 32-bit SPIRAM3FFAFB48 1 Blk esp_timer 388 580 4096 38080 644 217563FFBDD5C 2 Blk eventTask 440 1768 4608 0 0 03FFBFB58 3 Blk OVMS Events 436 3780 6144 86916 0 68003FFC4794 4 Blk OVMS CanRx 432 432 1024 0 0 03FFC884C 5 Blk ipc0 392 440 1024 7776 0 03FFC8E4C 6 Blk ipc1 392 440 1024 12 0 03FFCAC74 9 Rdy IDLE 368 496 1024 0 0 03FFCB208 10 Rdy IDLE 356 484 1024 0 0 03FFCBF9C 11 Blk Tmr Svc 392 680 3072 0 0 03FFCF9F4 16 Blk tiT 492 2348 3072 740 0 58683FFD5CA4 17 Blk OVMS SIMCOM 464 2496 4096 4400 0 03FFD7C54 18 Blk wifi 432 2304 4096 304 0 17083FFDA3EC 19 Blk pmT 408 1672 2560 0 0 03FFDAA04 20 Blk OVMS Vehicle 452 452 3072 0 0 03FFDEC24 21 Rdy OVMS Console 760 2600 6144 20 15488 120003FFDF604 22 Blk mdns 412 1732 4096 104 0 43FFE3118 23 Blk OVMS NetMan 728 2392 7168 1528 0 68
On 8 Apr 2018, at 3:27 PM, Michael Balzer <dexter@expeedo.de> wrote:
Am 07.04.2018 um 15:23 schrieb Michael Balzer:Another idea that can solve both issues: SignalEvent(event, data, [DoneCallback])
DoneCallback(event, data) would be called by the EventTask after listener execution has finished. The callback can implement memory cleanup and/or synchronous
processing (i.e. by a semaphore or task signal) as needed.
C++ now also has a nice lambda construct with very simple capturing of arbitrary scope parts by copy or reference. That enables nice inline callback definitions
like this:
char *data = strdup(message);
MyEvents.SignalEvent("simple.event", (void*)data, [data](){ free(data); });
…or…
SomeObject *clone = new SomeObject(original);
MyEvents.SignalEvent("object.event", (void*)clone, [clone](){ delete clone; });
Regards,
Michael
--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
_______________________________________________
OvmsDev mailing list
OvmsDev@lists.openvehicles.com
http://lists.openvehicles.com/mailman/listinfo/ovmsdev