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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1582 by aramv, Mon Jan 25 17:20:48 2010 UTC revision 1583 by aramv, Fri Mar 19 17:29:41 2010 UTC
# Line 1  Line 1 
1  #define _MULTI_THREADED  #define _MULTI_THREADED
2  #define NUM_THREADS 40  #define NUM_THREADS 2
3    
4  #include <stdio.h>  #include <stdio.h>
5  #include <stdlib.h>  #include <stdlib.h>
# Line 14  int main (int argc, char* argv[]){ Line 14  int main (int argc, char* argv[]){
14    void* status;    void* status;
15    
16    /*sleep(10);*/    /*sleep(10);*/
17      
18      aos_attribute_t* pemstring;
19      aos_context_t*   _context;
20      aos_attribute_t *_uid, *_gid;
21    
22      char* _uid_str = "1234";
23      char* _gid_str = "1234";
24    
25    
26    
27    if(argc > 1){    if(argc > 1){
28      config_file = argv[1];      config_file = argv[1];
# Line 26  int main (int argc, char* argv[]){ Line 35  int main (int argc, char* argv[]){
35          if(EEF_Init(config_file, NULL, 0, NULL) == EES_FAILURE){          if(EEF_Init(config_file, NULL, 0, NULL) == EES_FAILURE){
36      eef_log(LOG_ERR, "Failed to parse config file (%s), exiting...", config_file);      eef_log(LOG_ERR, "Failed to parse config file (%s), exiting...", config_file);
37    } else {    } else {
38      aos_start_threading();  
39      /* start threading */      /* fill aos */
40      for(t=0; t < NUM_THREADS; t++){      _uid = createAttribute();
41        printf("Creating thread %li!\n", t);      _gid = createAttribute();
42        rc = pthread_create(&threads[t], NULL, (void*)(void*) EEF_Run, (void*)(t));  
43        rc = pthread_join(threads[t], &status);      setAttributeId(_uid, "posix-uid");
44        setAttributeValue(_uid, _uid_str, strlen(_uid_str)+1);
45        setAttributeId(_gid, "posix-gid");
46        setAttributeValue(_gid, _gid_str, strlen(_gid_str)+1);
47    
48        if((_context = createContext(OBLIGATION)) != NULL){
49          setContextObligationId(_context, "uidgid");
50    
51          addAttribute(_context, _uid);
52          addAttribute(_context, _gid);
53    
54          addContext(_context);
55      }      }
56        aos_dump_argslist();
57        EEF_Run();
58        /*aos_start_threading();*/
59        /**//* start threading */
60        /*for(t=0; t < NUM_THREADS; t++){*/
61        /*printf("Creating thread %li!\n", t);*/
62        /*rc = pthread_create(&threads[t], NULL, (void*)(void*) EEF_Run, (void*)(t));*/
63        /*rc = pthread_join(threads[t], &status);*/
64        /*}*/
65    }    }
66    /*sleep(10);*/    /*sleep(10);*/
67    EEF_Term();    EEF_Term();
# Line 40  int main (int argc, char* argv[]){ Line 69  int main (int argc, char* argv[]){
69    
70    /*sleep(10);*/    /*sleep(10);*/
71    
72    pthread_exit(NULL);    /*pthread_exit(NULL);*/
73    return 0;    return 0;
74  }  }
75    

Legend:
Removed from v.1582  
changed lines
  Added in v.1583

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