File: test.c

package info (click to toggle)
ion 3.2.1%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,768 kB
  • ctags: 11,049
  • sloc: ansic: 141,798; sh: 22,848; makefile: 7,818; python: 1,638; sql: 311; perl: 197; awk: 178; xml: 50; java: 19
file content (43 lines) | stat: -rw-r--r-- 695 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* Program to repeatedly initiate/terminate a transaction
 * and ignore any SIGINT's sent to it.
 * Samuel Jero <sj323707@ohio.edu>
 * Ohio University
 * March 5, 2013*/

#include <stdlib.h>
#include <stdio.h>
#include "bp.h"
#include "sdrxn.h"
#include "platform.h"
#include "platform_sm.h"

void sighandler(){
	isignal(SIGINT, sighandler);
	printf("Got SIGINT\n");
}

int main()
{

	if (bp_attach() < 0)
	{
		printf("Can't Attached to BP!\n");
		return 1;
	}

	isignal(SIGINT, sighandler);

	while(1){
		if(!sdr_begin_xn(bp_get_sdr()))
		{
			printf("Begin Transaction Failed\n");
			return 1;
		}
		sm_TaskYield();
		sdr_end_xn(bp_get_sdr());
		sm_TaskYield();
	}

	bp_detach();
	return 0;
}