Unused druntime code: Barrier, ReadWriteMutex, Condition

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Jun 16 10:41:00 UTC 2026


On 16/06/2026 10:37 PM, Denis Feklushkin wrote:
> On Tuesday, 16 June 2026 at 10:21:43 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
> 
>> 3. All multi-threaded OS's should support these primitives.
> 
> Why? Because someone 20 years ago, apparently by accident, implemented 
> this code in the druntime?
> 
> This code isn't necessary for the druntime, that's the point. And the 
> operating system doesn't necessarily need to support it either. It's (I 
> repeat myself, excuse me) too high-level sync primitive, and not all 
> OSes can provide it.

So version it off like we do with bindings.

There is no reason to break existing code when we can do that.

```d
version(FreeRTOS)
	version = NoBarrier;

version(NoBarrier) {
	@disable
	class Barrier {}
} else {
	class Barrier {
		...
	}
}
```



More information about the Digitalmars-d mailing list