This is a little C++20 test using a futex to allow one to wait on a lock-free stack. The main stack logic is in struct ct_stack. Well, can
you get to compile and run? Thanks... There is no need for DWCAS here.
It uses just XCHG and CMPXCHG.
My code:
______________________________________
#include <iostream>
#include <thread>
#include <atomic>
#include <algorithm>
#include <cassert>
#define CT_THREAD_N (42)
#define CT_WORK_N (10000000)
#define CT_WAIT ((ct_node*)0xDEADBEEF)^^^^^^^^^^^^^^^^^^^^^^^
This is a little C++20 test using a futex to allow one to wait on a lock-free stack. The main stack logic is in struct ct_stack. Well, can
you get to compile and run? Thanks... There is no need for DWCAS here.
It uses just XCHG and CMPXCHG.
My code:
______________________________________
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,030 |
Nodes: | 10 (0 / 10) |
Uptime: | 61:41:05 |
Calls: | 13,349 |
Calls today: | 1 |
Files: | 186,574 |
D/L today: |
1,401 files (378M bytes) |
Messages: | 3,358,588 |