I use the old version of ecos (ecos 2.0 downloaded at December 2003). But I
searched the problem I have in the ecos bug tracking database and didn't find
it.
I use select() function to wait when the descriptor will be ready for reading.
Sometime select() returns 0 (time limit expire) but I am sure that the
requested descriptor was ready for reading some time ago. After that if I
perform the reading operation with this descriptor it completes successfully.
I think that I know the reason of this problem. The structure of cyg_pselect()
function is:
int cyg_pselect( )
{
while (!error)
{
for (mode = 0; !error && mode < 3; mode++)
{
...
// Checking the descriptors to be ready to requested operation
...
}
...
Cyg_Scheduler::lock();
...
// Waiting for cyg_selwakeup() call
...
Cyg_Scheduler::unlock();
}
}
I think that the descriptor may come ready after the loop which checks the
descriptors to be ready to requested operation but before Cyg_Scheduler::lock()
function call. In this case cyg_pselect( ) will wait for descriptor even if
this descriptor is ready. My idea is to move Cyg_Scheduler::lock() call up.
int cyg_pselect( )
{
while (!error)
{
for (mode = 0; !error && mode < 3; mode++)
{
Cyg_Scheduler::lock();
...
// Checking the descriptors to be ready to requested operation
...
}
...
// Waiting for cyg_selwakeup() call
...
Cyg_Scheduler::unlock();
}
}
Is my idea good or not?
Gennady
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss