diff options
author | Adam Chlipala <adam@chlipala.net> | 2010-12-04 11:15:20 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2010-12-04 11:15:20 -0500 |
commit | 5e90aecd290f5ae8b4b10367cc0d8995be2a1d9d (patch) | |
tree | c60abe4025d03517d3a685076e32aa3fc48093a0 /tests | |
parent | 1c98f161a0e110b52e1000e731e0fc7bcb4d31b0 (diff) |
New argument to transactional free functions, to specify whether we are about to retry
Diffstat (limited to 'tests')
-rw-r--r-- | tests/transact.ur | 13 | ||||
-rw-r--r-- | tests/transact.urp | 5 | ||||
-rw-r--r-- | tests/transact.urs | 1 | ||||
-rw-r--r-- | tests/transactional.c | 12 | ||||
-rw-r--r-- | tests/transactional.h | 3 | ||||
-rw-r--r-- | tests/transactional.urp | 4 | ||||
-rw-r--r-- | tests/transactional.urs | 1 |
7 files changed, 39 insertions, 0 deletions
diff --git a/tests/transact.ur b/tests/transact.ur new file mode 100644 index 00000000..baf8ab94 --- /dev/null +++ b/tests/transact.ur @@ -0,0 +1,13 @@ +fun listHell n = + if n <= 0 then + [] + else + n :: List.append (listHell (n-1)) (listHell (n-1)) + +fun doit r = + Transactional.foo; + return <xml>{[listHell (readError r.N)]}</xml> + +fun main () = return <xml><body> + <form> <textbox{#N}/> <submit action={doit}/> </form> +</body></xml> diff --git a/tests/transact.urp b/tests/transact.urp new file mode 100644 index 00000000..dcd84854 --- /dev/null +++ b/tests/transact.urp @@ -0,0 +1,5 @@ +library transactional +rewrite all Transact/* + +$/list +transact diff --git a/tests/transact.urs b/tests/transact.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/tests/transact.urs @@ -0,0 +1 @@ +val main : unit -> transaction page diff --git a/tests/transactional.c b/tests/transactional.c new file mode 100644 index 00000000..54e26874 --- /dev/null +++ b/tests/transactional.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +#include "/usr/local/include/urweb/urweb.h" + +static void do_free(void *data, int will_retry) { + printf("will_retry = %d\n", will_retry); +} + +uw_unit uw_Transactional_foo(uw_context ctx) { + printf("Registering....\n"); + uw_register_transactional(ctx, NULL, NULL, NULL, do_free); +} diff --git a/tests/transactional.h b/tests/transactional.h new file mode 100644 index 00000000..afb15327 --- /dev/null +++ b/tests/transactional.h @@ -0,0 +1,3 @@ +#include "/usr/local/include/urweb/types.h" + +uw_unit uw_Transactional_foo(uw_context); diff --git a/tests/transactional.urp b/tests/transactional.urp new file mode 100644 index 00000000..4ff1fea7 --- /dev/null +++ b/tests/transactional.urp @@ -0,0 +1,4 @@ +ffi transactional +include transactional.h +link transactional.o +effectful Transactional.foo diff --git a/tests/transactional.urs b/tests/transactional.urs new file mode 100644 index 00000000..8dea9bca --- /dev/null +++ b/tests/transactional.urs @@ -0,0 +1 @@ +val foo : transaction {} |