tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [PATCH 3/3] stdatomic: stdatomic.h header


From: Elijah Stone
Subject: Re: [Tinycc-devel] [PATCH 3/3] stdatomic: stdatomic.h header
Date: Tue, 26 Jan 2021 19:29:56 -0800 (PST)

On Tue, 26 Jan 2021, Kyryl Melekhin wrote:

Also while atomics are probably better solution so using something like mutex or spinlock, they are platform dependant

They're no more platform-dependent than addition. Obviously they do need support from the CPU, but so does everything else. They don't depend on any OS-specific facilities or anything like that.

they just kind of produce code smell

How's that?

so personally I always tried to avoid using them, because portability issues might arrise at some point, especially with new hardware and embeded world.

I think you can generally depend on the existence of atomic operations. Embedded platforms are likely to be single-core, so atomicity is irrelevant (except for reentrance, but that's a whole other kettle of fish). Elsewhere, atomic operations are necessary to implement many algorithms efficiently, and they're part of the specification for many programming languages. So I can't imagine anyone would design a CPU that lacked them.

For my part, I have two projects that I would love to use tcc on but can't currently because of the lack of atomics.

 -E



reply via email to

[Prev in Thread] Current Thread [Next in Thread]