John Wittrock
4ef225172e
Make ck_pr_store_* and ck_pr_load_* a bit more type safe.
...
We use some macro trickery to enforce that ck_pr_store_* is actually
storing the correct type into the target variable, without any actual
side effects--by making the assignment into an rvalue and using a
comma expression, the compiler should optimize it away.
On the load side, we simply cast the result to the type of the target
variable for pointer loads.
There is an unsafe version of the store_ptr macro called
ck_pr_store_ptr_unsafe for those times when you are _really_ sure that
you know what you're doing.
This commit also updates some of the source files (ck_ht, ck_hs,
ck_rhs): ck_ht now uses the unsafe macro, as its conversion between
uintptr_t and void * is invalid under the new macros. ck_hs and ck_rhs
have had some casts added to preserve validity.
10 years ago
Samy Al Bahra
554e2f0874
whitespace: Strictly conform to C namespacing rules.
10 years ago
Samy Al Bahra
851098b552
ck_fifo: Add fences to ABA-friendly operations.
10 years ago
Samy Al Bahra
0dfd145aa6
whitespace: Update Copyright messages.
10 years ago
Samy Al Bahra
d6ba2a6273
whitespace: Sweeping whitespace changes.
...
Removing trailing whitespaces and newlines.
10 years ago
Samy Al Bahra
c75e470ed4
ck_fifo_spsc: De-initialize from head.
11 years ago
Samy Al Bahra
5ec8191ded
ck_fifo: Add ck_fifo_*_deinit routines.
...
These allow for reclamation of garbage node in an empty FIFO.
Based on patch submitted by Rajesh R <rr01803@gm....>.
11 years ago
Samy Al Bahra
c197b37df1
legal: Update Copyright statements.
11 years ago
Samy Al Bahra
5d8a273dbe
whitespace: Bulk whitespace changes.
12 years ago
Samy Al Bahra
e52fd0b405
ck_fifo: Migrate MPMC FIFO to ck_pr_fence_X_Y.
12 years ago
Samy Al Bahra
86884ed574
ck_fifo_mpmc: Fix NULL deference when re-using nodes.
...
If a FIFO entry is being re-used, it is possible for NULL
assignment to be triggered due to race with enqueue.
12 years ago
Samy Al Bahra
c4e50a193a
ck_fifo: Style fixes.
12 years ago
Samy Al Bahra
7d3fd9d227
ck_fifo: Get rid of load_depends usage for now.
...
Until a target pops up with a requirement for load_depends(),
the cost is not worth it for now.
12 years ago
Samy Al Bahra
33a9222923
legal: Update Copyright statements.
12 years ago
Samy Al Bahra
f3111b006b
ck_fifo: SPSC FIFO dequeue only requires load depends barrier.
12 years ago
Samy Al Bahra
955047a7d1
ck_{ring,fifo}: Add store fences while we lack load_store fences.
12 years ago
Samy Al Bahra
7530ca21b7
ck_fifo: Do not forget about node recycling.
12 years ago
Samy Al Bahra
ccbf28f0cb
ck_fifo: Remove unused variables, serialize MPMC insertion.
12 years ago
Samy Al Bahra
78f00eeeb6
ck_fifo_spsc: Fix implementation.
...
Do not be overly pedantic. Fix misplaced store
barrier and make sure to atomically load stub
pointer on reader side.
12 years ago
Samy Al Bahra
ccb1fd6d86
ck_fifo: Add some load fences for SPARC/PPC.
13 years ago
Samy Al Bahra
816e11ff61
ck_fifo: Add tryenqueue/trydequeue wait-free operations.
...
Pending regressions tests, taking snapshot while I move to cafe.
13 years ago
Samy Al Bahra
11505f8417
ck_fifo: Remove backoff behavior by default.
13 years ago
Samy Al Bahra
3cf265cba0
all: Strip trailing whitespaces.
13 years ago
Samy Al Bahra
706fd07de7
legal: Update Copyright statements.
13 years ago
Samy Al Bahra
01d368b703
ck_fifo: Use ck_spinlock instead of specific spinlock implementation.
13 years ago
Samy Al Bahra
d3f0a634ab
ck_fifo: Add a mechanism to extract the spare node from the SPSC FIFO.
14 years ago
Samy Al Bahra
6b627d9aad
ck_fifo: Add trylock interface to dequeue.
14 years ago
Samy Al Bahra
5b37b97f7e
ck_fifo: Add fifo trylock variant.
14 years ago
Samy Al Bahra
76411d5d63
ck_fifo: Add volatile variation of ISEMPTY, isempty.
14 years ago
Samy Al Bahra
c7a12c7ac2
ck_fifo: Add a simple spinlock interface for ck_fifo_spsc.
14 years ago
Samy Al Bahra
492faed9a3
Reformatting changes for my new laptop.
14 years ago
Samy Al Bahra
7bd5259505
ck_fifo: MPMC variant will return "garbage" pointer which user can re-use.
14 years ago
Samy Al Bahra
beafb7d78e
ck_fifo: Add back-off and remove recycle.
...
Recycle will just be a bottleneck. The MPMC interface should instead
return a junk pointer and allow the user to manage its lifetime in
a way they see fit.
14 years ago
Samy Al Bahra
5f2f69eebb
Work-around strict aliasing issue.
14 years ago
Samy Al Bahra
66ebe1a874
Drop usage of CK_CC_PACKED, prefer natural alignment.
...
CK_CC_PACKED will drop structures to one-byte alignment in certain
cases. Obviously, this will mean bad performance on most architectures.
Thanks to Matt Johnson from https://rigel.crhc.illinois.edu/ for
reporting this problem.
14 years ago
Samy Al Bahra
cbd30b2206
Initial import.
14 years ago