[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Thread safety of Storage.mod (m2iso, if important)
From: |
Gaius Mulley |
Subject: |
Re: Thread safety of Storage.mod (m2iso, if important) |
Date: |
Tue, 19 May 2020 10:30:10 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Dragiša Durić <address@hidden> writes:
> Hi Gaius,
>
> It is good news. As soon as I get some time, I will make it thread
> safe.
>
> I have no plans to change interfaces, yet :), but I will change
> implementations. I need to read up a bit on atomics w/ gcc/gm2. Any
> pointers?
>
> Regards,
> Dragiša
Hi Dragiša,
re: pointers - it would be worth examining the implementation of
gcc/m2/gm2-libs-iso/COROURTINES which uses RTco which wraps up the gcc
atomics library. If you are were using the iso threading library then
it might just be a case of changing:
implementation module Storage ;
to
implementation module Storage[MAX(PROTECTION)] ;
which will wrap all exported procedures from Storage with calls with:
PROCEDURE externalProcedure ;
VAR
old: PROTECTION ;
BEGIN
old := COROUTINES_TurnInterrupts (MAX(PROTECTION)) ;
original procedure body
old := COROUTINES_TurnInterrupts (old) ;
END externalProcedure ;
or if this doesn't suit then it might be appropriate to explore direct
calls to RTco - for creating a lock semaphore and then applying
wait/signal to create the critical regions.
regards,
Gaius