Re: A pass() identity range?

2021-12-02 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 2 December 2021 at 15:03:47 UTC, D Lark wrote: Because it does not seem like that from the tone of responses I have gotten: I did my due diligence, I believe, before posting my original reply to the old question. I had looked at the docs and also searched the forum. There is no

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

Re: Debugging D code with GDB

2021-12-02 Thread Eduard Staniloiu via Digitalmars-d-learn
On Tuesday, 30 November 2021 at 09:01:38 UTC, Iain Buclaw wrote: On Monday, 29 November 2021 at 14:48:21 UTC, Luís Ferreira wrote: [...] Indeed, gdb assumes calling convention is same as default for target (actually its been years since I last looked, but are calling conventions tags in

Re: Dub fails to run inside a docker container on MacBook

2021-12-02 Thread russhy via Digitalmars-d-learn
The first thing i'd check: - make sure you have curl installed on your docker image - make sure you link with the curl library (since you are using dub) That's on the notes: https://dlang.org/phobos/std_net_curl.html

Dub fails to run inside a docker container on MacBook

2021-12-02 Thread tastyminerals via Digitalmars-d-learn
I am trying to create a Docker image where I can build my dub project. Here is a simple Dockerfile. ``` FROM ubuntu as build RUN apt-get update \ && apt-get install --no-install-recommends -y -q locales build-essential apt-transport-https ca-certificates dub\ && apt-get clean \

Re: A pass() identity range?

2021-12-02 Thread D Lark via Digitalmars-d-learn
On Thursday, 2 December 2021 at 14:53:31 UTC, D Lark wrote: On Thursday, 2 December 2021 at 14:47:17 UTC, Paul Backus wrote: This is why it's generally frowned upon to revive old threads: the information they contain is often out of date, and potentially misleading to anyone who reads them

Re: A pass() identity range?

2021-12-02 Thread D Lark via Digitalmars-d-learn
On Thursday, 2 December 2021 at 14:47:17 UTC, Paul Backus wrote: On Thursday, 2 December 2021 at 11:35:53 UTC, D Lark wrote: I am a newcomer to D and I am looking for equivalent functionality in phobos (so far I have not found). The function you are looking for is [`std.range.tee`][1]. It

Re: A pass() identity range?

2021-12-02 Thread D Lark via Digitalmars-d-learn
On Thursday, 2 December 2021 at 14:47:17 UTC, Paul Backus wrote: On Thursday, 2 December 2021 at 11:35:53 UTC, D Lark wrote: I am a newcomer to D and I am looking for equivalent functionality in phobos (so far I have not found). The function you are looking for is [`std.range.tee`][1]. It

Re: A pass() identity range?

2021-12-02 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 2 December 2021 at 11:35:53 UTC, D Lark wrote: I am a newcomer to D and I am looking for equivalent functionality in phobos (so far I have not found). The function you are looking for is [`std.range.tee`][1]. It was added to Phobos in 2014 by [pull request #1965][2],

Re: A pass() identity range?

2021-12-02 Thread D Lark via Digitalmars-d-learn
On Thursday, 2 December 2021 at 13:22:55 UTC, Steven Schveighoffer wrote: On 12/2/21 6:35 AM, D Lark wrote: On Wednesday, 2 January 2013 at 18:49:06 UTC, H. S. Teoh wrote: Note the date of post you are responding to. When the system says "hey, you are responding to a really old thread, let

Re: A pass() identity range?

2021-12-02 Thread D Lark via Digitalmars-d-learn
On Thursday, 2 December 2021 at 13:22:55 UTC, Steven Schveighoffer wrote: On 12/2/21 6:35 AM, D Lark wrote: On Wednesday, 2 January 2013 at 18:49:06 UTC, H. S. Teoh wrote: Note the date of post you are responding to. When the system says "hey, you are responding to a really old thread, let

Re: Running only one instance of the app

2021-12-02 Thread Bagomot via Digitalmars-d-learn
On Thursday, 2 December 2021 at 13:28:12 UTC, Steven Schveighoffer wrote: On 12/2/21 7:05 AM, Bagomot wrote: This works for Windows. I need something similar for Linux and Macos. Tell me how, if you know. Maybe the standard library D already has the required functionality? Or are there

Re: Running only one instance of the app

2021-12-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/2/21 7:05 AM, Bagomot wrote: This works for Windows. I need something similar for Linux and Macos. Tell me how, if you know. Maybe the standard library D already has the required functionality? Or are there better ways to only run one instance of the app? Typically this is done using

Re: A pass() identity range?

2021-12-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/2/21 6:35 AM, D Lark wrote: On Wednesday, 2 January 2013 at 18:49:06 UTC, H. S. Teoh wrote: Note the date of post you are responding to. When the system says "hey, you are responding to a really old thread, let me fix that for you", you should click the button. Please don't reply to

Running only one instance of the app

2021-12-02 Thread Bagomot via Digitalmars-d-learn
Hello everyone! I need to allow only one instance of my application to run. I use this way for Windows: ```d import std.stdio; import std.utf; version(Windows) { import core.sys.windows.winbase; import core.sys.windows.windows; } void main(string[] args) { string

Re: A pass() identity range?

2021-12-02 Thread D Lark via Digitalmars-d-learn
On Wednesday, 2 January 2013 at 18:49:06 UTC, H. S. Teoh wrote: On Wed, Jan 02, 2013 at 07:19:31PM +0100, bearophile wrote: H. S. Teoh: [...] >but I thought tee() might be a better name. Python programmers have this "tee": http://docs.python.org/3/library/itertools.html#itertools.tee [...]

Re: How to make a new dub subpackage? [Answered]

2021-12-02 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 20 November 2021 at 13:45:43 UTC, BoQsc wrote: [...] To make a subpackage with dub; follow these general guidelines. **General guidelines** [...] Just a side note, you can also supply a name to init directly and it creates the directory etc: dub init myproject