visualdoj / datomic

Atomic (thread-safe) wrappers for some primitive types (integer, boolean, pointer)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

datomic

Overview

The library wraps some primitive types (integer, boolean and pointer) as objects. Each has initializer Init that sets initial value and finalizer Done. Each has methods SetValue, GetValue and a property Value. There are some other useful methods like Inc, CompareExchangeStrong etc.

All public methods and properties are atomic (or thread-safe). Practically that means that other threads cannot see the data in partially-updated state while method is executing. (But the data can be changed by other threads between successive calls.)

Note that basically all methods need to block CPU and update CPU caches. So overusing atomic operations does not help to increase performance. Always measure performance of your application.

See datomic.pas for details.

About

Atomic (thread-safe) wrappers for some primitive types (integer, boolean, pointer)

License:The Unlicense


Languages

Language:Pascal 100.0%