I’ve got a program that read from several serial lines.
I’ve made a function that manage a single line and so I’ve assigned a thread for each port I must read.
the problem is that when each thread are up, the system is very very slow (about 3 seconds slower for each thread)…
I think that is because the function have a thing of this kind:
//inizialization of the port etc..
fread (str, len, n, fp);
I do this because data transmission is not regular or what, so I alway check if there is data on the port, if those data are validatedI start read all the message…
now my question is: is that a problem generated only from the while , so can I sobstitute it with another statement, or is a thread priority problem? or anything else that I 've not mentioned?