Skip to content

Commit

Permalink
fixed threading problem in g2c_inq_dim() (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett authored Dec 25, 2024
1 parent 42ca847 commit 1becc9e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/g2cinq.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,5 +377,8 @@ g2c_inq_dim(int g2cid, int msg_num, int prod_num, int dim_num, size_t *len,
for (d = 0; d < dim->len; d++)
val[d] = dim->value[d];

/* If using threading, unlock the mutex. */
MUTEX_UNLOCK(m);

return ret;
}
8 changes: 8 additions & 0 deletions tests/tst_inq.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ main()
short year;
short center, subcenter;
unsigned char master_version, local_version;
size_t dimlen;
char dimname[G2C_MAX_NAME];
int p;

printf("\t\tinquiring about message %d...\n", m);
Expand Down Expand Up @@ -202,6 +204,12 @@ main()
if (drs_template[p] != expected_drs_template[m][p])
return G2C_ERROR;
}

if ((ret = g2c_inq_dim(g2cid, m, 0, 0, &dimlen, dimname, NULL)))
return ret;
/* printf("dimlen = %ld, dimname = %s\n", dimlen, dimname); */
if (dimlen != 151 || strcmp(dimname, "Latitude"))
return G2C_ERROR;
}

/* Close the file. */
Expand Down

0 comments on commit 1becc9e

Please sign in to comment.