LWDR SAOC Milestone 1, Weekly Report for 6th OCT to 15th OCT

Dylan Graham dylan.graham2000 at gmail.com
Fri Oct 15 13:01:26 UTC 2021


[Source Code](https://github.com/hmmdyl/LWDR)
[Plan](https://github.com/hmmdyl/SAoC2021/blob/main/plan.md)
[Proposal](https://github.com/hmmdyl/SAoC2021/blob/main/proposal.md)
[SAOC 
Projects](https://dlang.org/blog/2021/08/30/saoc-2021-projects/)

[Report for week 1 of milestone 
1](https://forum.dlang.org/thread/vodbtqqwvdmapnjzlzaq@forum.dlang.org)
[Report for week 2 of milestone 
1](https://forum.dlang.org/thread/sqounqxhveqhbcxcmxbw@forum.dlang.org)
[Report for week 3 of milestone 
1](https://forum.dlang.org/post/mwymjwilsleoilaijiiz@forum.dlang.org)

Light Weight D Runtime.
15th October, 2021.
Symmetry Autumn of Code, Week 4 of Milestone 1.

Hi all,
Apologies for the delay on this update. On Wednesday night (13th 
OCT), I was rushed to hospital for difficulty breathing and chest 
pains (started on Monday 11th OCT), which has impacted me a bit. 
Fortunately, as of the 15th of October, LWDR has [fulfilled 
milestone 
1](https://github.com/hmmdyl/SAoC2021/blob/main/plan.md#milestone-1) of my plan.

Between the 6th of October and the 15th, when possible, work was 
completed on task 2 of milestone 1 - implementation of object 
monitors and support for `synchronized`. The work was 
straight-forward. DRuntime's 
[`monitor_.d`](https://github.com/dlang/druntime/blob/master/src/rt/monitor_.d) was [ported to LWDR](https://github.com/hmmdyl/LWDR/blob/67c8a849a5405e17a0593dea10d67934482b3ffb/source/rt/monitor_.d). It was almost 1:1, except for stuff involving the global mutex (used for allocating monitors), which relied on LWDR-specified hooks.

A [series of hooks in 
`rtoslink.d`](https://github.com/hmmdyl/LWDR/blob/67c8a849a5405e17a0593dea10d67934482b3ffb/source/rtoslink.d#L38) have been added. They forward operations involving mutexes to the underlying platform. Ie, creating, destroying, locking and unlocking mutexes (using `synchronized` or `core.sync.mutex.Mutex`) are all forwarded through these functions.

An LWDR-specific [implementation of 
`core.sync.mutex.Mutex`](https://github.com/hmmdyl/LWDR/blob/67c8a849a5405e17a0593dea10d67934482b3ffb/source/core/sync/mutex.d#L16) has been completed. It attempts to replicate the functionality of [DRuntime's `Mutex` class](https://dlang.org/phobos/core_sync_mutex.html).

[`object.Monitor`](https://github.com/hmmdyl/LWDR/blob/67c8a849a5405e17a0593dea10d67934482b3ffb/source/object.d#L65) was implemented - it's just an interface with two functions. For a while I considered perhaps changing the interface to make manual memory management easier, but I prioritise compatibility with DRuntime more. I don't want potential users to have to learn the ins and outs of a new runtime, it should be as compatible as possible.

I'm sorry there isn't much at all this week. Hopefully the next 
will be better.

All the best,
Dylan Graham.


More information about the Digitalmars-d mailing list