Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
75af7a5a
Commit
75af7a5a
authored
Sep 20, 2012
by
Uwe Schulzweida
Browse files
listInitialize: set mutex type to PTHREAD_MUTEX_RECURSIVE
parent
90d481eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
75af7a5a
...
...
@@ -3,6 +3,10 @@
* Version 1.5.8 released
* using CGRIBEX library version 1.5.5
2012-09-20 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* listInitialize: set mutex type to PTHREAD_MUTEX_RECURSIVE
2012-09-11 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* cdfInqContents: make ncid local to varid
...
...
examples/cdi_write_reset.c
View file @
75af7a5a
#include
<stdio.h>
#include
"cdi.h"
#define nrun
3
0 // Number of runs
#define nrun
10
0 // Number of runs
#define nlon 12 // Number of longitudes
#define nlat 6 // Number of latitudes
#define nlev 5 // Number of levels
...
...
@@ -85,14 +85,13 @@ int run(int irun)
// Close the output stream
streamClose
(
streamID
);
// Destroy the object
/*
// Destroy the objects
vlistDestroy
(
vlistID
);
taxisDestroy
(
taxisID
);
zaxisDestroy
(
zaxisID1
);
zaxisDestroy
(
zaxisID2
);
gridDestroy
(
gridID
);
*/
return
0
;
}
...
...
@@ -103,7 +102,7 @@ int main(void)
for
(
irun
=
0
;
irun
<
nrun
;
++
irun
)
{
run
(
irun
);
//
cdiReset();
cdiReset
();
}
return
0
;
...
...
src/resource_handle.c
View file @
75af7a5a
...
...
@@ -2,6 +2,8 @@
# include "config.h"
#endif
#define _XOPEN_SOURCE 600
/* PTHREAD_MUTEX_RECURSIVE */
#include
<stdlib.h>
#include
<stdio.h>
...
...
@@ -134,7 +136,7 @@ void listDestroy ( void )
for
(
j
=
0
;
j
<
listSizeAllocated
[
i
];
j
++
)
{
listElem
=
listResources
[
i
]
+
j
;
if
(
listElem
->
val
)
if
(
listElem
->
val
)
listElem
->
ops
->
valDestroy
(
listElem
->
val
);
}
free
(
listResources
[
i
]
);
...
...
@@ -163,8 +165,12 @@ static
void
listInitialize
(
void
)
{
#if defined (HAVE_LIBPTHREAD)
pthread_mutexattr_t
ma
;
pthread_mutexattr_init
(
&
ma
);
pthread_mutexattr_settype
(
&
ma
,
PTHREAD_MUTEX_RECURSIVE
);
/* initialize global API mutex lock */
pthread_mutex_init
(
&
listMutex
,
NULL
);
pthread_mutex_init
(
&
listMutex
,
&
ma
);
pthread_mutexattr_destroy
(
&
ma
);
#endif
listNew
();
...
...
@@ -203,8 +209,8 @@ void listSizeExtend()
for
(
i
=
listSizeAllocated
[
nsp
];
i
<
newListSize
;
++
i
)
{
listResources
[
nsp
][
i
].
resH
=
namespaceIdxEncode2
(
nsp
,
i
);
listResources
[
nsp
][
i
].
next
=
listResources
[
nsp
]
+
i
+
1
;
listResources
[
nsp
][
i
].
resH
=
namespaceIdxEncode2
(
nsp
,
i
);
listResources
[
nsp
][
i
].
next
=
listResources
[
nsp
]
+
i
+
1
;
}
listResources
[
nsp
][
newListSize
-
1
].
next
=
freeListHead
[
nsp
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment