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

Ali Çehreli acehreli at yahoo.com
Sat Jan 30 12:28:16 UTC 2021


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 because the thread may be dead already.

However, studying the runtime code around thread_detachThis three years 
ago, I had realized that like many things in computing, the whole 
stop-the-world is wishful thinking because there is no guarantee that 
your "please suspend this thread" request to the OS has succeeded. You 
get a success return code back but it means your request succeeded not 
that the thread was or will be suspended. (I may be misremembering this 
point but I know that the runtime requests things where OS does not give 
full guarantee for.)

(Going off-topic, even clicking on a user interface is wishful thinking 
because a few times a year I attempt to click on something but another 
window element pops under my mouse pointer and I unintentionally click 
something else, commonly on web pages as they are being rendered by a 
browser: links move around on the page. This used to bother me but not 
anymore. Life is not perfect and I appreciate it. :) )

 > (Btw, I just "forced" my boss to buy your and Adam's book for me

Cool! :) It makes me a little sad that my online version is ahead of the 
paper version by a couple of years now. I want to update the paper as 
well but I want to work on work stuff like the topic of this discussion. 
:) (Related note: the ebook versions on the web page are more up-to-date 
than ones that you can buy especially because the versions on my web 
site include a table of contents section. Consider updating your ebook 
here: http://ddili.org/ders/d.en/index.html )

 > I'm trying to sneak in D @thecompany)

I still think D is a great tool but some use cases can be tough and 
sometimes embarrassing. :/

Ali




More information about the Digitalmars-d-learn mailing list