From 67c8a849a5405e17a0593dea10d67934482b3ffb Mon Sep 17 00:00:00 2001 From: Dylan Graham Date: Fri, 15 Oct 2021 23:38:15 +1100 Subject: [PATCH] [SAOC Milestone 1, Task 2] + Update README. + Document rtoslink.d hooks for the monitor implementation. --- README.md | 10 +++++----- source/rtoslink.d | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6adffab..c203743 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,13 @@ This is the light weight D runtime - it is a barebones runtime targeting ARM Cor 19. Static constructors and destructors (opt-in by version `LWDR_ModuleCtors`) 20. Shared static constructors and destructor (opt-in by version `LWDR_ModuleCtors`) 21. Module info (opt-in by version `LWDR_ModuleCtors`) +22. Object monitors (opt in by version `LWDR_Sync`) +23. Shared and sychronized (opt in by version `LWDR_Sync`) ### What doesn't work? -22. Exceptions and Throwables (experimental implementation was removed) -23. There is no GC implementation (primitive memory tracking is now available with `LWDR_TrackMem`, `RefCount!T` and `Unique!T` are now available) -24. Associative arrays -25. Object monitors (Milestone 1, Task 2) -26. Shared/synchronised (Milestone 1, Task 2) +24. Exceptions and Throwables (experimental implementation was removed) +25. There is no GC implementation (primitive memory tracking is now available with `LWDR_TrackMem`, `RefCount!T` and `Unique!T` are now available) +26. Associative arrays ### Which compilers can be used? LDC works the best. DMD is not compatible. GDC will work but points 18-21 inclusive aren't supported. diff --git a/source/rtoslink.d b/source/rtoslink.d index ff6c83d..2454011 100644 --- a/source/rtoslink.d +++ b/source/rtoslink.d @@ -37,12 +37,19 @@ these hooks depending on what is requested of the runtime by user code. version(LWDR_Sync) { + /// Called when LWDR wants to create a mutex. void* rtosbackend_mutexInit(); + /// Called when LWDR wants to destroy a mutex. void rtosbackend_mutexDestroy(void*); + /// LWDR wants to lock a mutex (eg, via synchronized). void rtosbackend_mutexLock(void*); + /// LWDR wants to unlock a mutex (eg, via synchronized). void rtosbackend_mutexUnlock(void*); + /// Attempt to lock a mutex. Returns 0 if couldn't, 1 if locked. int rtosbackend_mutexTryLock(void*); + /// LWDR stores a single, global mutex for its own implementation. This function creates it. Called on runtime start. void* rtosbackend_globalMutexInit(); + /// Destroy LWDR's global mutex. Called on runtime shutdown. void rtosbackend_globalMutexDestroy(void*); } } \ No newline at end of file