@@ -38,7 +38,7 @@ typedef struct {
3838 int sequence ;
3939} thd_t ;
4040
41- static int count = -1 ;
41+ static int fencecount = -1 ;
4242static char * prefix = NULL ;
4343static char * fence_name ;
4444static bool syncflag = false;
@@ -58,7 +58,7 @@ static void usage (void)
5858 fprintf (stderr ,
5959 "Usage: fence_api "
6060 "[--sync] [--symlink] [--namespace=ns] "
61- "count prefix\n" );
61+ "<fencecount> < prefix> \n" );
6262 exit (1 );
6363}
6464
@@ -104,7 +104,7 @@ void *thread (void *arg)
104104 flags |= FLUX_KVS_SYNC ;
105105
106106 if (!(f = flux_kvs_fence (t -> h , namespace , flags , fence_name ,
107- count , txn ))
107+ fencecount , txn ))
108108 || flux_future_get (f , NULL ) < 0 )
109109 log_err_exit ("flux_kvs_fence" );
110110
@@ -157,35 +157,35 @@ int main (int argc, char *argv[])
157157 if ((argc - optind ) != 2 )
158158 usage ();
159159
160- count = strtoul (argv [optind ], NULL , 10 );
161- if (count <= 1 )
162- log_msg_exit ("commit count must be > 1" );
160+ fencecount = strtoul (argv [optind ], NULL , 10 );
161+ if (fencecount <= 1 )
162+ log_msg_exit ("thread count must be > 1" );
163163 prefix = argv [optind + 1 ];
164164
165165 /* create a fence name for this test that is random-ish */
166166 srand (time (NULL ));
167167 num = rand ();
168168 fence_name = xasprintf ("%s-%d" , prefix , num );
169169
170- thd = xzmalloc (sizeof (* thd ) * count );
170+ thd = xzmalloc (sizeof (* thd ) * fencecount );
171171
172- for (i = 0 ; i < count ; i ++ ) {
172+ for (i = 0 ; i < fencecount ; i ++ ) {
173173 thd [i ].n = i ;
174174 if ((rc = pthread_attr_init (& thd [i ].attr )))
175175 log_errn (rc , "pthread_attr_init" );
176176 if ((rc = pthread_create (& thd [i ].t , & thd [i ].attr , thread , & thd [i ])))
177177 log_errn (rc , "pthread_create" );
178178 }
179179
180- for (i = 0 ; i < count ; i ++ ) {
180+ for (i = 0 ; i < fencecount ; i ++ ) {
181181 if ((rc = pthread_join (thd [i ].t , NULL )))
182182 log_errn (rc , "pthread_join" );
183183 }
184184
185185 /* compare results from all of the fences, the root ref info
186186 * should all be the same
187187 */
188- for (i = 1 ; i < count ; i ++ ) {
188+ for (i = 1 ; i < fencecount ; i ++ ) {
189189 if (!streq (thd [0 ].treeobj , thd [i ].treeobj ))
190190 log_msg_exit ("treeobj mismatch: %s != %s\n" ,
191191 thd [0 ].treeobj , thd [i ].treeobj );
@@ -197,7 +197,7 @@ int main (int argc, char *argv[])
197197 thd [0 ].sequence , thd [i ].sequence );
198198 }
199199
200- for (i = 0 ; i < count ; i ++ ) {
200+ for (i = 0 ; i < fencecount ; i ++ ) {
201201 free (thd [i ].treeobj );
202202 free (thd [i ].rootref );
203203 }
0 commit comments