static int prSerialPort_Cleanup(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot* self = g->sp;
	SerialPort* port = (SerialPort*)getSerialPort(self);

	if (port == 0) return errFailed;

	port->cleanup();

	post("SerialPort Cleanup\n");

	delete port;
	SetNil(slotRawObject(self)->slots+0);
	return errNone;
}
Example #2
0
static int prSerialPort_Cleanup(struct VMGlobals *g, int numArgsPushed)
{
	PyrSlot* self = g->sp;
	SerialPort* port = (SerialPort*)getSerialPort(self);

	if (port == 0) return errFailed;
	if (port->isCurrentThread()) {
		post("Cannot cleanup SerialPort from this thread. Call from AppClock thread.");
		return errFailed;
	}

	port->cleanup();

	post("SerialPort Cleanup\n");

	delete port;
	SetNil(slotRawObject(self)->slots+0);
	return errNone;
}