| 1247 | static modMessageRecord gMessagePool[kMessagePoolCount]; |
| 1248 | |
| 1249 | int 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 | |
| 1280 | int modMessageService(void) |
| 1281 | { |
no test coverage detected