/[pdpsoft]/trunk/grid-mw-security/ees/src/app/aos_threading_test.c
ViewVC logotype

Contents of /trunk/grid-mw-security/ees/src/app/aos_threading_test.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1230 - (show annotations) (download) (as text)
Thu Dec 3 15:22:32 2009 UTC (12 years, 1 month ago) by aramv
File MIME type: text/x-chdr
File size: 1135 byte(s)
Added aos threading test app
1 #include <stdio.h>
2 #include <pthread.h>
3 #include "config.h"
4 #include "eef.h"
5 #include "aos.h"
6
7 #define NUM_THREADS 2
8
9 int threaded_aos_setting(long foo);
10 int threaded_aos_getting(long foo);
11
12 int threaded_aos_setting(long foo){
13 setObligation(foo, "foobar");
14 printf("Setting in thread %li\n", foo);
15 return 1;
16 }
17
18 int threaded_aos_getting(long foo){
19 printf("Getting in thread %i\n", foo);
20 /*printf("Got: %p\n", getObligation("foobar"));*/
21 return 1;
22 }
23
24 int main (int argc, char* argv[]){
25 char* config_file;
26 pthread_t threads[NUM_THREADS];
27 long t;
28 int rc;
29
30 if(argc > 1){
31 config_file = argv[1];
32 } else {
33 config_file = "examples/example_1.pdl";
34 }
35
36 printf("Parsing config file %s\n", config_file);
37
38 if(EEF_Init(config_file, NULL, 0, NULL) == EES_FAILURE){
39 eef_log(LOG_ERR, "Failed to parse config file (%s), exiting...", config_file);
40 } else {
41 /* start threading */
42 for(t=0; t < NUM_THREADS; t++){
43 rc = pthread_create(&threads[t], NULL, threaded_aos_setting, (void*)t);
44 rc = pthread_create(&threads[t], NULL, threaded_aos_getting, (void*)t);
45 }
46 }
47 EEF_Term();
48 return 0;
49 }
50

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28