Re: sleeping vs sched_yield

2021-12-04 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 2 December 2021 at 23:29:17 UTC, Chris Katko wrote: Is there a D std.library accessible version of POSIX sched_yield: https://man7.org/linux/man-pages/man2/sched_yield.2.html D bindings for POSIX headers are provided by modules in the package `core.sys.posix`. So, for

Re: sleeping vs sched_yield

2021-12-02 Thread Stanislav Blinov via Digitalmars-d-learn
On Thursday, 2 December 2021 at 23:29:17 UTC, Chris Katko wrote: there's: ```d import core.thread; Thread.sleep( dur!("msecs")(10) ); ``` but what if you want to simply yield all remaining time back to the time scheduler? Is there a D std.library accessible version of POSIX

Re: sleeping vs sched_yield

2021-12-02 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Dec 02, 2021 at 11:29:17PM +, Chris Katko via Digitalmars-d-learn wrote: [...] > It seems I can (thanks to the amazing work of D community) simply do: > > ```d > extern(C) int sched_yield(void); // #include > ``` > > however, how does the linker know I need and not some local >

sleeping vs sched_yield

2021-12-02 Thread Chris Katko via Digitalmars-d-learn
there's: ```d import core.thread; Thread.sleep( dur!("msecs")(10) ); ``` but what if you want to simply yield all remaining time back to the time scheduler? Is there a D std.library accessible version of POSIX sched_yield: https://man7.org/linux/man-pages/man2/sched_yield.2.html It