Bug 84323

Summary: sal - add sane sleep interface: cleanup osl_waitThread
Product: LibreOffice Reporter: Michael Meeks <michael.meeks>
Component: LibreofficeAssignee: andreyai <yai.andre>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium CC: sbergman
Version: 4.3.0.2 rc   
Hardware: Other   
OS: All   
Whiteboard: EasyHack DifficultyBeginner SkillCpp TopicCleanup
i915 platform: i915 features:

Description Michael Meeks 2014-09-25 10:05:57 UTC
LibreOffice has a nice 'usleep' style function - but its docs suck.

the method is osl_waitThread - and it is sufficiently opaque that I couldn't find it:

include/osl/thread.h

/** Blocks the calling thread at least for the given number
    of time.
*/
SAL_DLLPUBLIC void SAL_CALL osl_waitThread(const TimeValue* pDelay);

That comment needs to be longer, describe the parameter, and mention the string 'sleep' and also 'usleep' ideally =)

It might be nice to have a usleep version that sets up the TimeValue for you in the hxx header too:

    static void SAL_CALL wait(const TimeValue& Delay)
    {
        osl_waitThread(&Delay);
    }

And then we should fix the call-sites that cooked their own version; even inside sal/ this happens:

cd sal ; git grep -5 Sleep

to find the several instances that need to be cleaned up here =)

Thanks !
Comment 1 Michael Meeks 2014-09-25 10:06:38 UTC
Easy-hackify ...
Comment 2 andreyai 2014-11-02 13:03:25 UTC
Hi

I would like to know what I suppose to do in this part:

And then we should fix the call-sites that cooked their own version; even inside sal/ this happens:

cd sal ; git grep -5 Sleep

to find the several instances that need to be cleaned up here =)

Should I replaces the places where Sleep  appears to wait or usleep or should I just remove Sleep.

Thanks
Comment 3 Michael Meeks 2014-11-03 10:09:04 UTC
We should do a functionally identical replacement of Sleep with our nice new, static / inline (?) usleep thing I guess: re-factoring & cleanup should provide something functionally identical in that commit.

Perhaps later we'll discover that we can do better and/or drop some sleeps too =)

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.