Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-30 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 30 January 2021 at 12:28:16 UTC, Ali Çehreli wrote: On 1/30/21 1:34 AM, Imperatorn wrote: > [...] should be > [...] I wonder whether doing something in the runtime is possible. For example, it may be more resilient and not crash when suspending a thread fails because the thread m

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-30 Thread IGotD- via Digitalmars-d-learn
On Saturday, 30 January 2021 at 12:28:16 UTC, Ali Çehreli wrote: I wonder whether doing something in the runtime is possible. For example, it may be more resilient and not crash when suspending a thread fails because the thread may be dead already. However, studying the runtime code around

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-30 Thread Ali Çehreli via Digitalmars-d-learn
On 1/30/21 1:34 AM, Imperatorn wrote: > With this knowledge we have now, what changes could and/or should be > made to make this process easier? 🤔 I wonder whether doing something in the runtime is possible. For example, it may be more resilient and not crash when suspending a thread fails bec

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-30 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 30 January 2021 at 05:44:37 UTC, Ali Çehreli wrote: On 1/24/21 2:28 AM, IGotD- wrote: > [...] course. Any > [...] not do D > [...] [...] Hmm, interesting, or what you should call it 😅 With this knowledge we have now, what changes could and/or should be made to make this process

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-29 Thread Ali Çehreli via Digitalmars-d-learn
On 1/24/21 2:28 AM, IGotD- wrote: > Any threads started by druntime has proper initialization of course. Any > thread started by any module written in another language will not do D > the thread initialization. And that of course has been what I've been trying to deal with. Bugs in the uses of

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-27 Thread tsbockman via Digitalmars-d-learn
On Thursday, 28 January 2021 at 00:58:17 UTC, rikki cattermole wrote: On 28/01/2021 1:16 PM, tsbockman wrote: The documentation build on dlang.org is broken. Check the source code or Adam D. Ruppe's dpldocs.info for the complete documentation: http://dpldocs.info/experimental-docs/core.thread.

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-27 Thread rikki cattermole via Digitalmars-d-learn
On 28/01/2021 1:16 PM, tsbockman wrote: The documentation build on dlang.org is broken. Check the source code or Adam D. Ruppe's dpldocs.info for the complete documentation: http://dpldocs.info/experimental-docs/core.thread.osthread.html Fixed: https://issues.dlang.org/show_bug.cgi?id=21309

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-27 Thread tsbockman via Digitalmars-d-learn
On Sunday, 24 January 2021 at 03:59:26 UTC, Ali Çehreli wrote: I am surprised how much I had learned at that time and how much I've already forgotten. :/ For example, my PR involves thread_setThis, which seems to be history now: https://docarchives.dlang.io/v2.068.0/phobos/core_thread.html#.t

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-24 Thread IGotD- via Digitalmars-d-learn
On Sunday, 24 January 2021 at 03:59:26 UTC, Ali Çehreli wrote: That must be the case for threads started by D runtime, right? It sounds like I must call rt_moduleTlsCtor explicitly for foreign threads. It's still not clear to me which modules' TLS variables are initialized (copied over). Only

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-23 Thread Ali Çehreli via Digitalmars-d-learn
Thank you very much for your answers. I think I've been on the right track and the following bug that I've mentioned has been messing up by hitting me randomly: https://issues.dlang.org/show_bug.cgi?id=11736 On 1/23/21 5:18 PM, IGotD- wrote: > During rt_init in the main thread, thread_attac

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-23 Thread IGotD- via Digitalmars-d-learn
On Sunday, 24 January 2021 at 00:24:55 UTC, Ali Çehreli wrote: One question I have is, does rt_init already do thread_attachThis? I ask because I have a library that is loaded by Python and things work even *without* calling thread_attachThis. During rt_init in the main thread, thread_att

Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-23 Thread Ali Çehreli via Digitalmars-d-learn
tl;dr I know enough to sense there are important stuff that I don't know. Even though I sometimes act[1] like someone who knows stuff, there are many fuzzy areas for me especially in the runtime. Things work great when D code is inside a D program. The runtime and module states are magically