nanoseconds problem in cocoa cog

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

nanoseconds problem in cocoa cog

EstebanLM
 
Hi,
I'm experimenting some "random hangs" with my latest builds of cocoa cog (any jit version, I don't know jet if stack too)
The application was hanging (but not crashing) each X random time and with no information, even running with gdb. After a while testing, I found that the problem was gere: 

/* sleep for microSeconds or until i/o becomes possible, avoiding
   sleeping in select() if timeout too small */

int aioSleepForUsecs(int microSeconds)
{
#if defined(HAVE_NANOSLEEP)
  if (microSeconds < (1000000/60)) /* < 1 timeslice? */
    {
      if (!aioPoll(0))
{
  struct timespec rqtp= { 0, microSeconds * 1000 };
  struct timespec rmtp;
  nanosleep(&rqtp, &rmtp);
  microSeconds= 0; /* poll but don't block */
}
    }
#endif
  return aioPoll(microSeconds);
}

and more precisely when calling nanosleep
for now, I disabled HAVE_NANOSLEEP definition, and I'm testing (right now, no hangs), but I don't know how this should work. 

Someone knows?

Cheers,
Esteban
Reply | Threaded
Open this post in threaded view
|

Re: nanoseconds problem in cocoa cog

EstebanLM
 
mmm... no, it looks like now it is hanging in aioPoll :(
I'm testing with a squeak 4.2 and the problem is evident and automatic... you can see the problem, if you want :)

cheers,
Esteban

El 11/04/2011, a las 6:00p.m., Esteban Lorenzano escribió:

Hi,
I'm experimenting some "random hangs" with my latest builds of cocoa cog (any jit version, I don't know jet if stack too)
The application was hanging (but not crashing) each X random time and with no information, even running with gdb. After a while testing, I found that the problem was gere: 

/* sleep for microSeconds or until i/o becomes possible, avoiding
   sleeping in select() if timeout too small */

int aioSleepForUsecs(int microSeconds)
{
#if defined(HAVE_NANOSLEEP)
  if (microSeconds < (1000000/60)) /* < 1 timeslice? */
    {
      if (!aioPoll(0))
{
  struct timespec rqtp= { 0, microSeconds * 1000 };
  struct timespec rmtp;
  nanosleep(&rqtp, &rmtp);
  microSeconds= 0; /* poll but don't block */
}
    }
#endif
  return aioPoll(microSeconds);
}

and more precisely when calling nanosleep
for now, I disabled HAVE_NANOSLEEP definition, and I'm testing (right now, no hangs), but I don't know how this should work. 

Someone knows?

Cheers,
Esteban