44#include "S4NoCFedLF/r1/src-gen/S4NoCFedLF/r1/lf_start.h"
55#include "S4NoCFedLF/r2/src-gen/S4NoCFedLF/r2/lf_start.h"
66
7-
87void * f1_thread (void * arg ) {
98 printf ("Starting federate 1 on core/thread 1\n" );
10- lf_start ();
9+ lf_start ();
1110 return NULL ;
1211}
1312
1413void * f2_thread (void * arg ) {
1514 printf ("Starting federate 2 on core/thread 2\n" );
16- lf_start_2 ();
15+ lf_start_2 ();
1716 return NULL ;
1817}
1918
2019int main (void ) {
21- pthread_t thread1 , thread2 ;
20+ pthread_t threads [ 2 ] ;
2221 printf ("Starting S4NOC Federated LF Example\n" );
23-
24- // Create threads for each federate
25- pthread_create (& thread1 , NULL , f1_thread , NULL );
26- pthread_create (& thread2 , NULL , f2_thread , NULL );
22+ pthread_create (& threads [0 ], NULL , f1_thread , NULL );
23+ pthread_create (& threads [1 ], NULL , f2_thread , NULL );
2724
2825 printf ("Threads created for federates.\n" );
2926
30- // Wait for both federates to finish
31- pthread_join (thread1 , NULL );
32- pthread_join (thread2 , NULL );
27+ pthread_join (threads [0 ], NULL );
28+ pthread_join (threads [1 ], NULL );
3329
3430 printf ("All federates finished.\n" );
35- return 0 ;
36- }
31+ return 0 ;
32+ }
0 commit comments