¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

S+ Change Rx Event


 

I'm getting a Thread Abort error in? my S+ code, when the processor is sent a STOPPROG command. Not a big deal but makes me wonder..
Is this still the correct way to handle buffer events in S+?

THREADSAFE CHANGE from_device
{
string sTemp[100];
while(1)
{
try
{
sTemp = gather("\x0D",from_device);
ParseRx(sTemp);
}
catch
{
Print("Error Processing from_device.%s",GetExceptionMessage());
}
}
}


 

I¡¯m not sure that¡¯s an error ¡ª in C# you can catch a ¡°ThreadAbortException¡± for an opportunity to do something just as your thread is being aborted ¡ª

Gather() is a blocking call that doesn¡¯t return until the delimiter has been detected, and if you wrap that in a try-catch and get a thread abort exception, at most that¡¯s an opportunity to do a last-minute operation, but certainly isn¡¯t an ¡°error¡± ¡ª if it¡¯s an unwanted opportunity, you don¡¯t have to do anything with it or report it. Just exit instead