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

Function fxSerialFlush

modules/io/serial/mac/serial.c:372–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372void fxSerialFlush(modTimer timer, void *refcon, int refconSize)
373{
374 xsSerial s = *(xsSerial *)refcon;
375
376 s->flush = NULL;
377
378 int result = write(s->fd, s->toWrite, s->bytesToWrite);
379 if (result > 0) {
380 s->toWrite += result;
381 s->bytesToWrite -= result;
382 }
383
384 if (s->bytesToWrite)
385 s->flush = modTimerAdd(0, 0, fxSerialFlush, &s, sizeof(s));
386 else if (!s->writable && s->hasOnWritable)
387 s->writable = modTimerAdd(0, 0, fxSerialWritable, &s, sizeof(s));
388}
389
390void fxSerialSetFormat(xsMachine *the, xsSerial s, char *format)
391{

Callers

nothing calls this directly

Calls 2

writeFunction · 0.50
modTimerAddFunction · 0.50

Tested by

no test coverage detected