MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / modMessagePostToMachineFromPool

Function modMessagePostToMachineFromPool

xs/platforms/esp/xsHost.c:1249–1278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1247static modMessageRecord gMessagePool[kMessagePoolCount];
1248
1249int modMessagePostToMachineFromPool(xsMachine *the, modMessageDeliver callback, void *refcon)
1250{
1251 modMessage msg;
1252 uint8_t i;
1253
1254 modCriticalSectionBegin();
1255
1256 for (i = 0, msg = gMessagePool; i < kMessagePoolCount; i++, msg++) {
1257 if (!msg->isStatic) {
1258 msg->isStatic = 1;
1259 break;
1260 }
1261 }
1262
1263 modCriticalSectionEnd();
1264
1265 if ((gMessagePool + kMessagePoolCount) == msg) {
1266 modLog("message pool full");
1267 return -1;
1268 }
1269
1270 msg->the = the;
1271 msg->callback = callback;
1272 msg->refcon = refcon;
1273 msg->length = 0;
1274
1275 appendMessage(msg);
1276
1277 return 0;
1278}
1279
1280int modMessageService(void)
1281{

Callers 6

digitalMonitorISRFunction · 0.50
digitalMonitorISRFunction · 0.50
xs_serial_constructorFunction · 0.50
serial_isrFunction · 0.50
digitalISRFunction · 0.50
modSerial.cFile · 0.50

Calls 1

appendMessageFunction · 0.70

Tested by

no test coverage detected