@@ -18,6 +18,8 @@ void test_threads_refdb__cleanup(void)
1818
1919#define REPEAT 20
2020#define THREADS 20
21+ /* Number of references to create or delete in each thread */
22+ #define NREFS 10
2123
2224struct th_data {
2325 int id ;
@@ -59,7 +61,7 @@ static void *create_refs(void *arg)
5961 struct th_data * data = (struct th_data * ) arg ;
6062 git_oid head ;
6163 char name [128 ];
62- git_reference * ref [10 ];
64+ git_reference * ref [NREFS ];
6365 git_repository * repo ;
6466
6567 cl_git_pass (git_repository_open (& repo , data -> path ));
@@ -69,14 +71,14 @@ static void *create_refs(void *arg)
6971 } while (error == GIT_ELOCKED );
7072 cl_git_pass (error );
7173
72- for (i = 0 ; i < 10 ; ++ i ) {
74+ for (i = 0 ; i < NREFS ; ++ i ) {
7375 p_snprintf (name , sizeof (name ), "refs/heads/thread-%03d-%02d" , data -> id , i );
7476 do {
7577 error = git_reference_create (& ref [i ], repo , name , & head , 0 , NULL );
7678 } while (error == GIT_ELOCKED );
7779 cl_git_pass (error );
7880
79- if (i == 5 ) {
81+ if (i == NREFS / 2 ) {
8082 git_refdb * refdb ;
8183 cl_git_pass (git_repository_refdb (& refdb , repo ));
8284 do {
@@ -86,7 +88,7 @@ static void *create_refs(void *arg)
8688 }
8789 }
8890
89- for (i = 0 ; i < 10 ; ++ i )
91+ for (i = 0 ; i < NREFS ; ++ i )
9092 git_reference_free (ref [i ]);
9193
9294 git_repository_free (repo );
@@ -105,7 +107,7 @@ static void *delete_refs(void *arg)
105107
106108 cl_git_pass (git_repository_open (& repo , data -> path ));
107109
108- for (i = 0 ; i < 10 ; ++ i ) {
110+ for (i = 0 ; i < NREFS ; ++ i ) {
109111 p_snprintf (
110112 name , sizeof (name ), "refs/heads/thread-%03d-%02d" , (data -> id ) & ~0x3 , i );
111113
@@ -121,7 +123,7 @@ static void *delete_refs(void *arg)
121123 git_reference_free (ref );
122124 }
123125
124- if (i == 5 ) {
126+ if (i == NREFS / 2 ) {
125127 git_refdb * refdb ;
126128 cl_git_pass (git_repository_refdb (& refdb , repo ));
127129 do {
0 commit comments