C does not allow any field (in a struct) to be of the type void.
I assume that you did something like pointer(void). If so, please
try pointer(int) or pointer(ptr).
On Fri, Oct 25, 2019 at 3:25 PM Vanessa McHale wrote:
> Unfortunately, that fails to compile (the C code) with:
>
> In file
Unfortunately, that fails to compile (the C code) with:
In file included from .atspkg/c/test/stack.c:14:
.atspkg/c/test/stack.c: In function
‘_057_home_057_vanessa_057_programming_057_ats_057_stack_057_SATS_057_stack_056_sats__push__1__1’:
.atspkg/c/test/stack.c:2884:21: error: variable or field
I looked around this morning to see what approaches are used nowadays for
implementing
lock-free data structures. It seems that RCU is the way to go:
http://libcds.sourceforge.net/
With linear views, one should be able to capture some of the reasoning
behind RCUs, facilitating
the construction of
Thanks!
Is there any neat way to use views with a lock-free stack, then? I'm
fine ignoring frees for the moment, but it would be interesting to see
how to do such a thing safely in ATS...
Cheers,
Vanessa
On 3/1/19 11:23 PM, gmhwxi wrote:
>
> If we ignore malloc/free, then lock-free stack
If we ignore malloc/free, then lock-free stack implementation
should look more or less like the following code:
fun
pop(theStack) = let
var xs0 = theStack
in
case+ xs0 of
| nil() => None_vt()
| cons(x0, xs1) =>
if atomic_compare_exchange(theStack, xs0, xs1)
then Some_vt(x0)
I took a quick look.
The paper gives an algorithm for implementing a queue, and your code
implements
a stack. The stack implementation contains a few race conditions. For
example, say that thread A pops
and thread B pops as well; after thread A frees a node, thread B could try
to free it again,
I don't think it's due to polymorphic functions, because the problem
goes away when I switch to using only one thread.
Cheers,
Vanessa
On 3/1/19 8:43 PM, Richard wrote:
> At first glance, making the functions polymorphic (as opposed to templates)
> could be a potential reason for segmentation
At first glance, making the functions polymorphic (as opposed to templates)
could be a potential reason for segmentation faults (see
https://github.com/githwxi/ATS-Postiats/issues/216). Though mixing dependent
types and templates together has also been known to cause issues (see
Hi all,
I've been trying to implement a lock-free stack here:
https://github.com/vmchale/stack. Unfortunately, this is not something
I'm particularly familiar with, and it segfaults around 70% of the time
I try to actually do anything with it.
Here is the static bit:
%{#
#include
%}
typedef