Hello Guest it is April 16, 2024, 04:24:01 PM

Author Topic: Error triggered - Art Code: 8877  (Read 4744 times)

0 Members and 1 Guest are viewing this topic.

Error triggered - Art Code: 8877
« on: May 27, 2013, 11:56:07 AM »
I can start a thread and output serial data constantly without problems.

As soon as I do a serialPort->ReadByte() or serialPort->Read(buf, 0, 1) - I get an error on start up of Mach.  It's "Art Code: 8877".

I've tried it both with blocking reads and with a timeout.

Anybody have any insights on "Art Code 8877"?

Thanks
Re: Error triggered - Art Code: 8877
« Reply #1 on: May 28, 2013, 03:09:50 AM »
I'd still like to understand what's going on - but I've worked around it in a slightly more processor intensive way.

Instead of blocking on the read, I did the following.......

void ReadSomeBytes(array<unsigned char>^ buffer, UInt16 offset, UInt16 count)
{
   while ((MG::thcData.thcSerial->BytesToRead < count))
   {
      // Kill the thread if requested.
      if (MG::thcControl.hariKari)
         ExitThread(0);
      // Didn't get killed, so sleep a little
      Sleep(5);
   }

   // Read the bytes.
   MG::thcData.thcSerial->Read(buffer, offset, count);
}

 ("hariKari" is a boolean flag that the plug-in uses to signal the serial input processing thread to gracefully shut down.)