[dpdk-dev] [PATCH v7 1/5] eal: add sleep API

Morten Brørup mb at smartsharesystems.com
Wed Apr 7 09:31:43 CEST 2021


> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Dmitry Kozlyuk
> Sent: Wednesday, April 7, 2021 1:30 AM
> 
> 2021-04-06 16:34 (UTC+0200), Morten Brørup:
> > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Dmitry Kozlyuk
> > > Sent: Sunday, April 4, 2021 1:41 AM
> > >
> > > POSIX sleep(3) is missing from Windows.
> > > Add generic rte_thread_sleep() to suspend current OS thread.
> > >
> > > Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk at gmail.com>
> > > Acked-by: Khoa To <khot at microsoft.com>
> > > Acked-by: Ray Kinsella <mdr at ashroe.eu>
> >
> > How is this better than the rte_delay_us_sleep() function in
> rte_cycles.
> 
> Honestly, I just assumed the sleep() shim existed for a reason.
> Now that you pointed to it, I think indeed no new API is needed.
> 
> I wonder why rte_delay_us_sleep() is not used throughout DPDK.

I think it's just tradition from Linux/BSD developers not being used to cross-platform development or having forgotten how to develop software for deeply embedded systems without a standard O/S below. We use POSIX functions like sleep() without thinking about it, and simply forget looking for an EAL variant of the function first.

> Should their usages be converted as soon as code is enabled for
> Windows?

Yes. The Environment Abstraction Layer is there to avoid using O/S specific function calls. So it should be safe to replace all these sleep() calls with the EAL variant at any time.



More information about the dev mailing list