Page 1 of 1

sleep and usleep in libogc 1.8.15 not working

Posted: Tue Jan 03, 2017 5:14 pm
by Oibaf
The sleep and usleep functions does not work in libogc 1.8.15.
"sleep" freezes the Wii with any value. "usleep" freezes the Wii with big values or when it is called several times.
Since all my projects use the sleep functions, none of them works with the new lib.

Could this be the cause of MAME and network sockettest example not working?

Could it be caused by some problems with the thread managment?

Re: sleep and usleep in libogc 1.8.15 not working

Posted: Wed Jan 04, 2017 4:04 am
by WinterMute
It's definitely a distinct possibility. Thanks for pointing this out.

If you could try compiling a fresh copy of libogc with optimisations turned down that might help narrow things down a bit too.

Re: sleep and usleep in libogc 1.8.15 not working

Posted: Wed Jan 04, 2017 1:08 pm
by Oibaf
You were right. It is an optimization issue.

I tried with no optimization flag, -O2 and -O3. All of them give a working sleep function.
I also tried other thread tests (i.e. mutex) which did not work; they work with the optimizations above.
I also compiled with -Os (the flag used in your distribution pack) and the sleep function does work.

This are the sizes of libocg.a lib files:
0s: 2,896 KB
02: 3,125 KB
03: 4,436 KB

I am using the O2 version. ll seems to work now.

Re: sleep and usleep in libogc 1.8.15 not working

Posted: Wed Jan 04, 2017 10:07 pm
by Oibaf
I wanted to say that with -Os flag, sleep function does not work

Re: sleep and usleep in libogc 1.8.15 not working

Posted: Thu Jan 05, 2017 3:34 pm
by WinterMute
Thanks for doing this. I've recompiled the libogc release with -O2 and uploaded a new archive. Shall have to see if I can track down what's happening with -Os later.