Skip to content

Commit

Permalink
Revert "include/spinlock: explicit casts for C++ compilation"
Browse files Browse the repository at this point in the history
This reverts commit 8698ada.
Concurrency Kit uses idiomatic C99+.
  • Loading branch information
Samy Al Bahra committed Feb 20, 2019
1 parent 4e9b23b commit 9bd98ad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/spinlock/clh.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ck_spinlock_clh_lock(struct ck_spinlock_clh **queue, struct ck_spinlock_clh *thr
* Mark current request as last request. Save reference to previous
* request.
*/
previous = CK_CPP_CAST(struct ck_spinlock_clh *, ck_pr_fas_ptr(queue, thread));
previous = ck_pr_fas_ptr(queue, thread);
thread->previous = previous;

/* Wait until previous thread is done with lock. */
Expand Down
4 changes: 2 additions & 2 deletions include/spinlock/hclh.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ ck_spinlock_hclh_lock(struct ck_spinlock_hclh **glob_queue,
ck_pr_fence_store_atomic();

/* Mark current request as last request. Save reference to previous request. */
previous = CK_CPP_CAST(struct ck_spinlock_hclh *, ck_pr_fas_ptr(local_queue, thread));
previous = ck_pr_fas_ptr(local_queue, thread);
thread->previous = previous;

/* Wait until previous thread from the local queue is done with lock. */
Expand All @@ -107,7 +107,7 @@ ck_spinlock_hclh_lock(struct ck_spinlock_hclh **glob_queue,

/* Now we need to splice the local queue into the global queue. */
local_tail = ck_pr_load_ptr(local_queue);
previous = CK_CPP_CAST(struct ck_spinlock_hclh *, ck_pr_fas_ptr(glob_queue, local_tail));
previous = ck_pr_fas_ptr(glob_queue, local_tail);

ck_pr_store_uint(&local_tail->splice, true);

Expand Down
2 changes: 1 addition & 1 deletion include/spinlock/mcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ck_spinlock_mcs_lock(struct ck_spinlock_mcs **queue,
* returns NULL, it means the queue was empty. If the queue was empty,
* then the operation is complete.
*/
previous = CK_CPP_CAST(struct ck_spinlock_mcs *, ck_pr_fas_ptr(queue, node));
previous = ck_pr_fas_ptr(queue, node);
if (previous != NULL) {
/*
* Let the previous lock holder know that we are waiting on
Expand Down

1 comment on commit 9bd98ad

@thibault-martinez
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sbahra ,
What's the motivation for reverting this ?
CK_CPP_CAST seems to be used in other places in CK.
Also CK_CPP_CAST is noop when compiled in C so why to remove it ?

Please sign in to comment.