Druntime without pthreads?

IGotD- nise at nise.com
Wed Oct 21 00:03:56 UTC 2020

On Tuesday, 20 October 2020 at 16:58:12 UTC, Severin Teona wrote:
> Hi guys.
> I have a curiosity, regarding [1] - I had encountered some 
> "undefined reference" errors when trying to link the druntime 
> (compiled for an embedded architecture) without some 
> implementation of the POSIX thread calls (and other stuff too).
> My curiosity is what would change if I removed from the 
> druntime everything that has to do with mutexes or threads. 
> Would it be possible for the druntime to run and work properly 
> on a microcontroller - where those concepts are not necessary? 
> Could I just remove everything about synchronisation from the 
> druntime, and classes or Garbage Collector to still work 
> properly?
> [1]: 
> https://forum.dlang.org/post/erwfgtigvcciohllvaos@forum.dlang.org

Yes, you can stub the thread and mutex interfaces. You will of 
course not be able use that or any part of the library that uses 
threads  but you will be able to get to the main entry point and 
run a single threaded D program.

This is something we would want with the druntime API change, a 
stub that people can use when they don't need the functionality 
or as a starting point for implementing your own version.

More information about the Digitalmars-d-learn mailing list