Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thread-safe execution support to netcdf-c #2505

Open
wants to merge 226 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
226 commits
Select commit Hold shift + click to select a range
bf67bf9
ckp
DennisHeimbigner Sep 6, 2022
a344940
ckp
DennisHeimbigner Sep 7, 2022
9aa3cb1
ckp
DennisHeimbigner Sep 10, 2022
5afafc1
ckp
DennisHeimbigner Sep 10, 2022
e23d8f0
ckp
DennisHeimbigner Sep 10, 2022
1cba558
ckp
DennisHeimbigner Sep 11, 2022
00fabb2
debug1
DennisHeimbigner Sep 12, 2022
bd0bed5
vs1
DennisHeimbigner Sep 12, 2022
27399a3
fix nc4var.c
DennisHeimbigner Sep 12, 2022
13ebabb
push
DennisHeimbigner Sep 12, 2022
daa2e26
settings
DennisHeimbigner Sep 12, 2022
002497a
cmake1
DennisHeimbigner Sep 13, 2022
c6d36ab
win32
DennisHeimbigner Sep 13, 2022
d975450
debug1
DennisHeimbigner Sep 13, 2022
40b208a
debug2
DennisHeimbigner Sep 13, 2022
0a77db1
cmake
DennisHeimbigner Sep 13, 2022
7770ec2
cstd1
DennisHeimbigner Sep 13, 2022
35eeccd
barrier1
DennisHeimbigner Sep 13, 2022
50125a4
barrier2
DennisHeimbigner Sep 13, 2022
03c048d
barrier3
DennisHeimbigner Sep 13, 2022
f8cd6f8
barrier4
DennisHeimbigner Sep 13, 2022
807f070
barrier5
DennisHeimbigner Sep 13, 2022
92d4e0d
barrier6
DennisHeimbigner Sep 13, 2022
e7ba293
barrier7
DennisHeimbigner Sep 13, 2022
f8953be
barrier8
DennisHeimbigner Sep 13, 2022
6d9a112
bar9
DennisHeimbigner Sep 13, 2022
3608b1e
bar10
DennisHeimbigner Sep 13, 2022
156be8f
bar1
DennisHeimbigner Sep 13, 2022
2ab1610
bar12
DennisHeimbigner Sep 13, 2022
c6645e7
valg1
DennisHeimbigner Sep 13, 2022
fca3723
Merge branch 'threadsafe.tmp' of https://github.com/DennisHeimbigner/…
DennisHeimbigner Sep 13, 2022
68523b5
core1
DennisHeimbigner Sep 13, 2022
73d8a99
core2
DennisHeimbigner Sep 13, 2022
ddbe68f
core3
DennisHeimbigner Sep 13, 2022
0dcfe90
core5
DennisHeimbigner Sep 13, 2022
5d91c12
push1
DennisHeimbigner Sep 13, 2022
ba7c987
three1
DennisHeimbigner Sep 14, 2022
76f102c
docs
DennisHeimbigner Sep 14, 2022
161197c
ckp
DennisHeimbigner Sep 14, 2022
e6a57bb
ckp
DennisHeimbigner Sep 14, 2022
d7d371d
Add EXPERIMENTAL thread-safe execution support to netcdf-c
DennisHeimbigner Sep 14, 2022
9209023
Update release notes
DennisHeimbigner Sep 14, 2022
3a984e3
ckp
DennisHeimbigner Sep 15, 2022
be0167e
ckp2
DennisHeimbigner Sep 15, 2022
5a8f617
ckp
DennisHeimbigner Sep 16, 2022
7a1a4ee
apt1
DennisHeimbigner Sep 16, 2022
b5fce2a
Merge branch 'threadsafe.tmp' of https://github.com/DennisHeimbigner/…
DennisHeimbigner Sep 16, 2022
fa7bd2b
ll1
DennisHeimbigner Sep 16, 2022
f58753e
pt1
DennisHeimbigner Sep 16, 2022
13a6a90
u1
DennisHeimbigner Sep 16, 2022
ac79d97
u2
DennisHeimbigner Sep 16, 2022
7f50e75
prop1
DennisHeimbigner Sep 16, 2022
b6f1369
force1
DennisHeimbigner Sep 16, 2022
94a4e33
debug1
DennisHeimbigner Sep 17, 2022
750a413
debug8
DennisHeimbigner Sep 17, 2022
ff92496
debug9
DennisHeimbigner Sep 17, 2022
b2fcb03
debug10
DennisHeimbigner Sep 17, 2022
3431811
ckp
DennisHeimbigner Sep 17, 2022
c813366
Merge branch 'master' into threadsafe.tmp
DennisHeimbigner Sep 17, 2022
e30aaa5
debug12
DennisHeimbigner Sep 17, 2022
caf8f30
cpu4
DennisHeimbigner Sep 18, 2022
09fceb1
print1
DennisHeimbigner Sep 18, 2022
200ad16
x1
DennisHeimbigner Sep 18, 2022
8cbf35d
print2
DennisHeimbigner Sep 18, 2022
dd52385
print5
DennisHeimbigner Sep 18, 2022
d0036e1
assert1
DennisHeimbigner Sep 18, 2022
ea78520
pop1
DennisHeimbigner Sep 18, 2022
ab2d865
pop2
DennisHeimbigner Sep 18, 2022
eb37845
fix1
DennisHeimbigner Sep 18, 2022
0537efd
noass1
DennisHeimbigner Sep 18, 2022
4b4c6bc
ass1
DennisHeimbigner Sep 18, 2022
f2396df
noass2
DennisHeimbigner Sep 18, 2022
faa65b6
xxx1
DennisHeimbigner Sep 18, 2022
af9be22
final1
DennisHeimbigner Sep 18, 2022
0db9017
final1
DennisHeimbigner Sep 18, 2022
bf4c643
update
DennisHeimbigner Sep 18, 2022
e9eb0b1
upthread1
DennisHeimbigner Sep 18, 2022
44b9a7e
unpush
DennisHeimbigner Sep 18, 2022
97e010b
Fix bugs in threadsafe branch
DennisHeimbigner Sep 18, 2022
a062037
ckp
DennisHeimbigner Sep 22, 2022
f889d55
Update WRT main
DennisHeimbigner Oct 20, 2022
c3a8dda
Update conflicts
DennisHeimbigner Oct 20, 2022
8a10704
ckp
DennisHeimbigner Oct 20, 2022
93bea0a
Update release notes
DennisHeimbigner Oct 20, 2022
63be8b8
Merge branch 'threadsafe.dmh' into threadsafe.tmp
DennisHeimbigner Oct 20, 2022
e46f56b
update
DennisHeimbigner Oct 31, 2022
22f5f52
Update to match main
DennisHeimbigner Oct 31, 2022
f31fa80
ckp
DennisHeimbigner Nov 1, 2022
9aae020
win32
DennisHeimbigner Nov 1, 2022
85f52db
Merge branch 'threadsafe.tmp' of https://github.com/DennisHeimbigner/…
DennisHeimbigner Nov 1, 2022
2a37239
update
DennisHeimbigner Nov 1, 2022
38387d7
Merge branch 'threadsafe.tmp' of https://github.com/DennisHeimbigner/…
DennisHeimbigner Nov 1, 2022
48a8cf1
dfalt
DennisHeimbigner Nov 1, 2022
2b8dff1
fix
DennisHeimbigner Nov 1, 2022
f8dfb49
update
DennisHeimbigner Nov 1, 2022
dd9c08b
ckp
DennisHeimbigner Nov 3, 2022
d8f85df
update
DennisHeimbigner Nov 3, 2022
ec59a43
ckp
DennisHeimbigner Nov 3, 2022
36f57eb
ckp
DennisHeimbigner Nov 4, 2022
2619fa3
test
DennisHeimbigner Nov 4, 2022
ac7e47e
ckp
DennisHeimbigner Nov 4, 2022
6aeaa45
switch
DennisHeimbigner Nov 4, 2022
1c3c0b1
Fix some distcheck problems with nczarr_test and dap4_test
DennisHeimbigner Nov 4, 2022
106960a
action test
DennisHeimbigner Nov 5, 2022
8fd9042
netcdf_threadsafe.h
DennisHeimbigner Nov 5, 2022
de63166
Update release notes
DennisHeimbigner Nov 5, 2022
a688ccc
typo
DennisHeimbigner Nov 5, 2022
9c2cb42
missing-include
DennisHeimbigner Nov 5, 2022
8a651c9
cmake threadsafe
DennisHeimbigner Nov 5, 2022
e76dacb
docs
DennisHeimbigner Nov 5, 2022
4ae57e6
docs
DennisHeimbigner Nov 5, 2022
8951070
Merge branch 'distcheckfix.dmh' into threadsafe.tmp
DennisHeimbigner Nov 5, 2022
1435202
Fix memory leak
DennisHeimbigner Nov 5, 2022
3171d0c
Cleanup some issues with nullfree
DennisHeimbigner Nov 5, 2022
f1a8da4
ckp
DennisHeimbigner Nov 5, 2022
5a0de0e
merge
DennisHeimbigner Nov 5, 2022
55c3ecc
update file permission
DennisHeimbigner Nov 6, 2022
73fd7cd
switch
DennisHeimbigner Nov 7, 2022
276aab4
fixes
DennisHeimbigner Nov 7, 2022
5d9dea0
update
DennisHeimbigner Feb 6, 2023
7bc963b
update
DennisHeimbigner Feb 6, 2023
db2e8ea
push
DennisHeimbigner Feb 6, 2023
71b29b4
ckp
DennisHeimbigner Feb 7, 2023
44c3053
Update
DennisHeimbigner Apr 4, 2023
c58a836
update
DennisHeimbigner Apr 4, 2023
0a6c3ce
update2
DennisHeimbigner Apr 4, 2023
b2216be
ckp
DennisHeimbigner Apr 5, 2023
5884438
update
DennisHeimbigner Apr 30, 2023
8e662b6
update
DennisHeimbigner Apr 30, 2023
3fd93fb
xget1
DennisHeimbigner Apr 30, 2023
02744d3
xget1
DennisHeimbigner Apr 30, 2023
bd3b755
conflicts
DennisHeimbigner Apr 30, 2023
d22c9bb
getopt
DennisHeimbigner Apr 30, 2023
d1bd0f7
Merge branch 'threadsafe.tmp' of https://github.com/DennisHeimbigner/…
DennisHeimbigner Apr 30, 2023
0003c59
ckp
DennisHeimbigner Apr 30, 2023
f005d89
ckp
DennisHeimbigner May 21, 2023
81b7404
ckp
DennisHeimbigner May 21, 2023
a1baa7e
update file permission
DennisHeimbigner May 21, 2023
cec3056
fix cmake tests
DennisHeimbigner May 21, 2023
ac1cc34
ckp
DennisHeimbigner May 21, 2023
ec2d32b
update
DennisHeimbigner May 21, 2023
a1ddd09
extern
DennisHeimbigner May 21, 2023
5c64096
extern2
DennisHeimbigner May 21, 2023
3089a13
extern3
DennisHeimbigner May 21, 2023
54c34ff
test1
DennisHeimbigner May 24, 2023
bff2fd3
Merge branch 'master' into threadsafe.tmp
DennisHeimbigner May 24, 2023
72fbe67
test2
DennisHeimbigner May 24, 2023
553ac21
cyg
DennisHeimbigner May 26, 2023
1bd43c7
m4
DennisHeimbigner May 26, 2023
a02e21e
ckp
DennisHeimbigner May 28, 2023
f6723be
Merge branch 'threadsafe.tmp' of https://github.com/DennisHeimbigner/…
DennisHeimbigner May 28, 2023
ea6858b
ckp
DennisHeimbigner May 29, 2023
0a5bc18
switch
DennisHeimbigner May 30, 2023
72f72a5
ckp
DennisHeimbigner May 30, 2023
7a8ef1c
debug
DennisHeimbigner May 30, 2023
848db83
mem
DennisHeimbigner May 30, 2023
c73e016
test1
DennisHeimbigner May 30, 2023
013fe85
test5
DennisHeimbigner May 31, 2023
3849124
ckp
DennisHeimbigner May 31, 2023
0ea74fb
gdb1
DennisHeimbigner May 31, 2023
20e7e8c
gdb2
DennisHeimbigner May 31, 2023
dac4424
ldd1
DennisHeimbigner May 31, 2023
441b37f
gdb5
DennisHeimbigner May 31, 2023
0f10818
gdb6
DennisHeimbigner May 31, 2023
1dfdfe8
gdb10
DennisHeimbigner May 31, 2023
d1d0ef0
debug1
DennisHeimbigner May 31, 2023
e217bea
debug2
DennisHeimbigner May 31, 2023
0801938
all1
DennisHeimbigner May 31, 2023
35d7d4b
mingw1
DennisHeimbigner May 31, 2023
c9559c5
all2
DennisHeimbigner May 31, 2023
27b9733
all3
DennisHeimbigner May 31, 2023
936d31d
Merge branch 'master' into threadsafe.tmp
DennisHeimbigner May 31, 2023
cb9e9a3
update to master
DennisHeimbigner May 31, 2023
10e6252
nop
DennisHeimbigner May 31, 2023
1ffac18
final1
DennisHeimbigner May 31, 2023
f52edce
unpush
DennisHeimbigner May 31, 2023
0925601
## Addendum (5/31/2023)
DennisHeimbigner May 31, 2023
3e9eebe
debugappveyor
DennisHeimbigner Jun 1, 2023
7ea1b2b
appv1
DennisHeimbigner Jun 1, 2023
6a6605c
appv2
DennisHeimbigner Jun 1, 2023
573d076
appv3
DennisHeimbigner Jun 1, 2023
3b81b5b
appv4
DennisHeimbigner Jun 1, 2023
61c31ae
pt1
DennisHeimbigner Jun 1, 2023
70661ee
pt5
DennisHeimbigner Jun 1, 2023
df9dd34
appv10
DennisHeimbigner Jun 1, 2023
0f0b088
appv20
DennisHeimbigner Jun 1, 2023
74b1468
app30
DennisHeimbigner Jun 1, 2023
5675392
appv4
DennisHeimbigner Jun 1, 2023
f807e0b
appv5
DennisHeimbigner Jun 1, 2023
2cfb8d3
thread1
DennisHeimbigner Jun 1, 2023
aa42971
thread2
DennisHeimbigner Jun 1, 2023
dbccc8c
thread5
DennisHeimbigner Jun 1, 2023
5fba471
thread6
DennisHeimbigner Jun 1, 2023
68e1fc6
debug1
DennisHeimbigner Jun 1, 2023
485a44b
debug2
DennisHeimbigner Jun 1, 2023
073561b
debug3
DennisHeimbigner Jun 1, 2023
ed15a92
debug4
DennisHeimbigner Jun 1, 2023
e6b399e
debug5
DennisHeimbigner Jun 1, 2023
7293403
debug6
DennisHeimbigner Jun 1, 2023
e1a1bcd
debug7
DennisHeimbigner Jun 1, 2023
222c23f
debug8
DennisHeimbigner Jun 1, 2023
37054c1
debug9
DennisHeimbigner Jun 2, 2023
f33f845
debug10
DennisHeimbigner Jun 2, 2023
1f52ed6
debug11
DennisHeimbigner Jun 2, 2023
b50c726
debug12
DennisHeimbigner Jun 2, 2023
8036da4
debug14
DennisHeimbigner Jun 2, 2023
819e524
debug15
DennisHeimbigner Jun 2, 2023
8cd956c
debug16
DennisHeimbigner Jun 2, 2023
bb41f0a
pt1
DennisHeimbigner Jun 2, 2023
778ce36
test1
DennisHeimbigner Jun 2, 2023
74603d6
test2
DennisHeimbigner Jun 2, 2023
37030ed
merged
DennisHeimbigner Jun 2, 2023
bc0e62f
update
DennisHeimbigner Jun 2, 2023
2b3f726
switch
DennisHeimbigner Jun 2, 2023
07ced2c
unpush
DennisHeimbigner Jun 2, 2023
c230d6e
update
DennisHeimbigner Jun 2, 2023
31aa916
push
DennisHeimbigner Jun 2, 2023
0ed4687
extra file
DennisHeimbigner Jun 3, 2023
fe0d641
Update to master
DennisHeimbigner Jul 9, 2023
63c5c8b
Merge branch 'threadsafe.dmh' into threadsafe.tmp
DennisHeimbigner Jul 9, 2023
3176296
Merge branch 'threadsafe.tmp' of https://github.com/DennisHeimbigner/…
DennisHeimbigner Jul 9, 2023
3960785
update
DennisHeimbigner Oct 10, 2023
6be2701
fix
DennisHeimbigner Oct 10, 2023
a8e64ef
add locks on new API functions
DennisHeimbigner Oct 11, 2023
a73a5c1
Merge branch 'master' into threadsafe.dmh
DennisHeimbigner Oct 13, 2023
6aaafd5
update to master
DennisHeimbigner Dec 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/run_tests_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:

- name: Install System dependencies
shell: bash -l {0}
run: sudo apt update && sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev mpich libmpich-dev
run: sudo apt update && sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev mpich libmpich-dev

###
# Installing libhdf5
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:

- name: Install System dependencies
shell: bash -l {0}
run: sudo apt update && sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen valgrind
run: sudo apt update && sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen

###
# Set Environmental Variables
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:

- name: Configure
shell: bash -l {0}
run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --enable-doxygen --enable-external-server-tests --disable-xml2
run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --enable-doxygen --enable-external-server-tests --disable-xml2 --enable-threadsafe
if: ${{ success() }}

- name: Look at config.log if error
Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:

- name: Install System dependencies
shell: bash -l {0}
run: sudo apt update && sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev mpich libmpich-dev
run: sudo apt update && sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev mpich libmpich-dev

###
# Set Environmental Variables
Expand Down Expand Up @@ -344,7 +344,7 @@ jobs:
run: |
mkdir build
cd build
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DENABLE_DAP=TRUE -DENABLE_HDF5=TRUE -DENABLE_NCZARR=TRUE -DENABLE_DAP_LONG_TESTS=TRUE -DENABLE_XML2=FALSE
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DENABLE_DAP=TRUE -DENABLE_HDF5=TRUE -DENABLE_NCZARR=TRUE -DENABLE_DAP_LONG_TESTS=TRUE -DENABLE_XML2=FALSE -DENABLE_THREADSAFE=TRUE

- name: Print Summary
shell: bash -l {0}
Expand Down Expand Up @@ -391,7 +391,7 @@ jobs:

- name: Install System dependencies
shell: bash -l {0}
run: sudo apt update && sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen mpich libmpich-dev
run: sudo apt update && sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen mpich libmpich-dev

###
# Set Environmental Variables
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/run_tests_win_cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ jobs:
--disable-static --enable-dap --disable-dap-remote-tests
--enable-plugins ${{ matrix.plugin_dir_option }}
--disable-nczarr --disable-nczarr-filters
--disable-s3 --with-s3-testing=no

--disable-s3 --with-s3-testing=no --enable-threadsafe

- name: Look at config.log if error
if: ${{ failure() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests_win_mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: autoreconf -if

- name: (Autotools) Configure Build
run: ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --disable-static --disable-byterange --disable-dap-remote-tests --disable-logging --enable-plugins --disable-nczarr-filters --disable-s3
run: ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --disable-static --disable-byterange --disable-dap-remote-tests --disable-logging --enable-plugins --disable-nczarr-filters --disable-s3 --enable-threadsafe
if: ${{ success() }}

- name: (Autotools) Look at config.log if error
Expand Down
79 changes: 66 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,54 @@ IF(MSVC)
ENDIF()
ENDIF()

# Control thread-safe operation
OPTION (ENABLE_THREADSAFE "Enable Thread safe operation" OFF)

SET(Threads_FOUND FALSE)
IF(MSVC)
FIND_PACKAGE(PTHREADS4W QUIET)
IF(PTHREADS4W_FOUND)
GET_TARGET_PROPERTY(PTHREADS4W_LIBS Threads::Threads IMPORTED_IMPLIB_RELEASE)
GET_TARGET_PROPERTY(PTHREADS4W_IMPL Threads::Threads IMPORTED_LOCATION_RELEASE)
GET_TARGET_PROPERTY(PTHREADS4W_INCLUDE_DIR Threads::Threads INTERFACE_INCLUDE_DIRECTORIES)
SET(Threads_FOUND ${PTHREADS4W_FOUND})
SET(CMAKE_THREAD_LIBS_INIT ${PTHREADS4W_LIBS})
SET(CMAKE_USE_WIN32_THREADS_INIT FALSE)
SET(CMAKE_USE_PTHREADS_INIT TRUE)
SET(CMAKE_HP_PTHREADS_INIT FALSE)
INCLUDE_DIRECTORIES(${PTHREADS4W_INCLUDE_DIR})
ENDIF(PTHREADS4W_FOUND)
ENDIF(MSVC)

IF(NOT Threads_FOUND)
# Look for some other pthreads library
SET(THREADS_PREFER_PTHREAD_FLAG TRUE)
FIND_PACKAGE(Threads)
# If the window's threads is found, then do not use it.
if(CMAKE_USE_WIN32_THREADS_INIT)
message(WARNING "*** Only WinThreads found, so disable Threads_FOUND")
SET(Threads_FOUND FALSE)
ENDIF()
# SET_TARGET_PROPERTIES(Threads::Threads PROPERTIES IMPORTED_GLOBAL TRUE)
ENDIF(NOT Threads_FOUND)

IF(Threads_FOUND)
SET(HAVE_PTHREADS YES CACHE BOOL "Have pthreads library")
ELSE()
SET(HAVE_PTHREADS NO CACHE BOOL "Have pthreads library")
ENDIF()

IF(ENABLE_THREADSAFE)
SET(PTHREAD_T_MAX_SIZE 64 CACHE STRING "|pthread_t|")
ELSE()
SET(PTHREAD_T_MAX_SIZE 0 CACHE STRING "|pthread_t|")
ENDIF()

# Consistency
IF(ENABLE_THREADSAFE AND NOT HAVE_PTHREADS)
MESSAGE(FATAL_ERROR "ENABLE_THREADSAFE requires HAVE_PTHREADS; Please disable ENABLE_THREADSAFE")
ENDIF()

# Option to build netCDF Version 2
OPTION (ENABLE_V2_API "Build netCDF Version 2." ON)
SET(BUILD_V2 ${ENABLE_V2_API})
Expand Down Expand Up @@ -840,8 +888,6 @@ IF(USE_HDF5)

ENDIF(HDF5_C_LIBRARY AND HDF5_HL_LIBRARY AND HDF5_INCLUDE_DIR)

FIND_PACKAGE(Threads)

# There is a missing case in the above code so default it
IF(NOT HDF5_C_LIBRARY_hdf5 OR "${HDF5_C_LIBRARY_hdf5}" STREQUAL "" )
SET(HDF5_C_LIBRARY_hdf5 "${HDF5_C_LIBRARY}")
Expand Down Expand Up @@ -911,17 +957,22 @@ IF(USE_HDF5)

# H5Pset_fapl_mpiposix and H5Pget_fapl_mpiposix have been removed since HDF5 1.8.12.
# Use H5Pset_fapl_mpio and H5Pget_fapl_mpio, instead.
# CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pget_fapl_mpiposix "" HDF5_IS_PARALLEL_MPIPOSIX)
# CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pget_fapl_mpiposix "" HDF5_IS_PARALLEL_MPIO)

if(Threads_FOUND)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pget_fapl_mpio "" HDF5_IS_PARALLEL_MPIO)
endif()

IF(HDF5_IS_PARALLEL_MPIO)
SET(HDF5_PARALLEL ON)
ELSE()
SET(HDF5_PARALLEL OFF)
ENDIF()

if(NOT Threads_FOUND)
#Check to see if HDF5 library has collective metadata APIs, (HDF5 >= 1.10.0)
CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_all_coll_metadata_ops "" HDF5_HAS_COLL_METADATA_OPS)
endif()

IF(HDF5_PARALLEL)
SET(HDF5_CC h5pcc)
Expand Down Expand Up @@ -1064,7 +1115,9 @@ ELSE()
SET(ENABLE_DAP2 OFF CACHE BOOL "")
SET(ENABLE_DAP4 OFF CACHE BOOL "")
ENDIF()

# Default disable dap4 for now
#SET(ENABLE_DAP4 OFF CACHE BOOL "")

# Option to support byte-range reading of remote datasets
OPTION(ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." ON)
if(NOT ENABLE_REMOTE_FUNCTIONALITY)
Expand Down Expand Up @@ -1263,14 +1316,13 @@ IF(ENABLE_EXTRA_TESTS)
SET(EXTRA_TESTS ON)
ENDIF()

# Option to use bundled XGetopt in place of getopt(). This is mostly useful
# for MSVC builds. If not building utilities or some tests,
# Check if getopt is available else use bundled XGetopt.
# This is mostly useful for MSVC builds. If not building utilities or some tests,
# getopt() isn't required at all.
IF(MSVC)
OPTION(ENABLE_XGETOPT "Enable bundled XGetOpt instead of external getopt()." ON)
IF(ENABLE_XGETOPT)
SET(USE_X_GETOPT ON CACHE BOOL "")
ENDIF()
SET(USE_X_GETOPT ON CACHE BOOL "")
ELSE()
SET(USE_X_GETOPT OFF CACHE BOOL "")
ENDIF()

SET(MATH "")
Expand Down Expand Up @@ -1677,7 +1729,7 @@ OPTION(ENABLE_NCZARR_FILTERS_TESTING "Enable NCZarr filter testing." ON)

# Constraints
IF (NOT ENABLE_PLUGINS)
MESSAGE(WARNING "ENABLE_FILTER_TESTING requires shared libraries. Disabling.")
MESSAGE(WARNING "ENABLE_NCZARR_FILTERS requires ENABLE_PLUGINS. Disabling.")
SET(ENABLE_NCZARR_FILTERS OFF CACHE BOOL "Enable NCZarr Filters." FORCE)
ENDIF()

Expand Down Expand Up @@ -1795,7 +1847,7 @@ IF(NOT HAVE_UNISTD_H)
ENDIF()

CHECK_INCLUDE_FILE("alloca.h" HAVE_ALLOCA_H)
CHECK_INCLUDE_FILE("malloc.h" HAVE_MALLOC_H)
CHECK_INCLUDE_FILE("malloc.h" HAVE_MALLOC_H)
CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
CHECK_INCLUDE_FILE("getopt.h" HAVE_GETOPT_H)
CHECK_INCLUDE_FILE("locale.h" HAVE_LOCALE_H)
Expand Down Expand Up @@ -2143,7 +2195,7 @@ ENDMACRO()

# Binary tests which are used by a script looking for a specific name.
MACRO(build_bin_test_no_prefix F)
build_bin_test(${F})
build_bin_test(${F} ${ARGN})
IF(MSVC)
#SET_PROPERTY(TEST ${F} PROPERTY FOLDER "tests/")
SET_TARGET_PROPERTIES(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
Expand Down Expand Up @@ -2609,6 +2661,7 @@ is_enabled(HAVE_ZSTD HAS_ZSTD)
is_enabled(HAVE_BLOSC HAS_BLOSC)
is_enabled(HAVE_BZ2 HAS_BZ2)
is_enabled(ENABLE_REMOTE_FUNCTIONALITY DO_REMOTE_FUNCTIONALITY)
is_enabled(ENABLE_THREADSAFE IS_THREADSAFE)

if(ENABLE_S3_INTERNAL)
SET(WHICH_S3_SDK "internal")
Expand Down
9 changes: 9 additions & 0 deletions config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ are set when opening a binary file on Windows. */
/* if true, Force use of S3 internal library */
#cmakedefine ENABLE_S3_INTERNAL 1

/* if true, Support serialized thread safe operation */
#cmakedefine ENABLE_THREADSAFE 1

/* if true, enable S3 testing*/
#cmakedefine WITH_S3_TESTING "PUBLIC"

Expand Down Expand Up @@ -346,6 +349,9 @@ are set when opening a binary file on Windows. */
/* Define to 1 if you have the `random' function. */
#cmakedefine HAVE_RANDOM 1

/* Define to 1 if you have the pthreads library */
#cmakedefine HAVE_PTHREADS 1

/* Define to 1 if you have the `snprintf' function. */
#cmakedefine HAVE_SNPRINTF 1

Expand Down Expand Up @@ -534,6 +540,9 @@ with zip */
/* define the possible sources for remote test servers */
#cmakedefine REMOTETESTSERVERS "${REMOTETESTSERVERS}"

/* Max size for pthread_t instance */
#cmakedefine PTHREAD_T_MAX_SIZE @PTHREAD_T_MAX_SIZE@

/* The size of `ulonglong` as computed by sizeof. */
#cmakedefine SIZEOF_ULONGLONG @SIZEOF_ULONGLONG@

Expand Down
37 changes: 35 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,35 @@ ISMINGW=yes
ISMSYS=yes
fi

# See if we have libpthreads
AC_SEARCH_LIBS([pthread_mutex_init],[pthreads pthreads.dll cygpthreads.dll], [have_pthreads=yes], [have_pthreads=no])
if test "x$have_pthreads" = "xyes" ; then
AC_CHECK_LIB([pthread],[pthread_mutex_init],[],[]) # Make sure it gets included in the lib list
AC_DEFINE([HAVE_PTHREADS], [1], [if true, pthreads is available])
fi

AC_MSG_CHECKING([whether we should enable thread safety])
AC_ARG_ENABLE([threadsafe], [AS_HELP_STRING([--enable-threadsafe],
[enable thread-safe operation (default=no)])])
test "x$enable_threadsafe" = xyes || enable_threadsafe=no
AC_MSG_RESULT([$enable_threadsafe])
if test "x$enable_threadsafe" = xyes && test "x$have_pthreads" = xno ; then
AC_MSG_NOTICE([!pthreads => !threadsafe])
enable_threadsafe=no
fi

if test "x$enable_threadsafe" = xyes ; then
AC_DEFINE([ENABLE_THREADSAFE], [1], [if true, include experimental thread safe code])
AC_DEFINE_UNQUOTED([PTHREAD_T_MAX_SIZE], [64], [|pthread_t|])
else
AC_DEFINE_UNQUOTED([PTHREAD_T_MAX_SIZE], [0], [|pthread_t|])
fi
AM_CONDITIONAL(ENABLE_THREADSAFE, [test "x$enable_threadsafe" = xyes])

# Setup the config.h

# Get windows version info
if test "x$ISMSVC" = xyes ; then
if test "x$ISMINGW" = xyes || test "x$ISMSVC" = xyes ; then
WINVER=`systeminfo | sed -e '/^OS Version:/p' -ed | sed -e 's|[^0-9]*\([0-9.]*\).*|\1|'`
else
WINVER="0.0.0"
Expand Down Expand Up @@ -621,7 +648,6 @@ fi
AM_CONDITIONAL(ENABLE_QUANTIZE, [test x$enable_quantize = xyes])

# --enable-dap => enable-dap4
enable_dap4=$enable_dap
AC_MSG_CHECKING([whether dap use of remotetest server should be enabled])
AC_ARG_ENABLE([dap-remote-tests],
[AS_HELP_STRING([--disable-dap-remote-tests],
Expand Down Expand Up @@ -1303,6 +1329,11 @@ AC_CHECK_HEADERS([libgen.h])
AC_HEADER_STDC
AC_CHECK_HEADERS([locale.h stdio.h stdarg.h fcntl.h malloc.h stdlib.h string.h strings.h unistd.h sys/stat.h getopt.h sys/time.h sys/types.h time.h dirent.h stdint.h ctype.h])

# Do getopt.h separately so we can AM_CONDITIONAL it.
# This should still do the implicit AC_DEFINE.
AC_CHECK_HEADERS([getopt.h],[havegetopth=yes],[havegetopth=no])
AM_CONDITIONAL(HAVE_GETOPT_H, [test "x$havegetopth" = xyes])

# Do sys/resource.h separately
#AC_CHECK_HEADERS([sys/resource.h],[havesysresource=1],[havesysresource=0])
#if test "x$enable_dll" != xyes ; then
Expand Down Expand Up @@ -2057,6 +2088,7 @@ AC_SUBST(HAS_SZLIB_WRITE, [$have_sz])
AC_SUBST(HAS_ZSTD,[$have_zstd])
AC_SUBST(DO_LARGE_TESTS,[$enable_large_file_tests])
AC_SUBST(DO_REMOTE_FUNCTIONALITY,[$enable_remote_functionality])
AC_SUBST(IS_THREADSAFE,[$enable_threadsafe])

if test "x$enable_s3_aws" = xyes ; then
AC_SUBST(WHICH_S3_SDK,[aws-sdk-cpp])
Expand Down Expand Up @@ -2217,6 +2249,7 @@ AX_SET_META([NC_HAS_SZIP],[$enable_hdf5_szip],[yes])
AX_SET_META([NC_HAS_ZSTD],[$have_zstd],[yes])
AX_SET_META([NC_HAS_BLOSC],[$have_blosc],[yes])
AX_SET_META([NC_HAS_BZ2],[$have_bz2],[yes])
AX_SET_META([NC_IS_THREADSAFE],[$enable_threadsafe],[yes])

# This is the version of the dispatch table. If the dispatch table is
# changed, this should be incremented, so that user-defined format
Expand Down
3 changes: 2 additions & 1 deletion dap4_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)

FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libdap4)

IF(ENABLE_DAP_REMOTE_TESTS)
# Change name (add '4') to avoid cmake
# complaint about duplicate targets.
Expand All @@ -36,7 +38,6 @@ IF(ENABLE_TESTS)
# keep it from being too bad.

IF(BUILD_UTILITIES)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libdap4)
build_bin_test(test_parse)
build_bin_test(test_meta)
IF(USE_X_GETOPT)
Expand Down
2 changes: 1 addition & 1 deletion docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ inmemory.md DAP2.dox FAQ.md
known_problems.md
COPYRIGHT.dox user_defined_formats.md DAP4.md DAP4.dox
testserver.dox byterange.md filters.md nczarr.md auth.md quantize.md
quickstart_paths.md cloud.md)
quickstart_paths.md cloud.md threadsafe.md)

ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
1 change: 1 addition & 0 deletions docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ INPUT = @abs_top_srcdir@/docs/mainpage.dox \
@abs_top_srcdir@/docs/indexing.dox \
@abs_top_srcdir@/docs/testserver.dox \
@abs_top_srcdir@/docs/quantize.md \
@abs_top_srcdir@/docs/threadsafe.md \
@abs_top_srcdir@/docs/attribute_conventions.md \
@abs_top_srcdir@/docs/file_format_specifications.md \
@abs_top_srcdir@/docs/all-error-codes.md \
Expand Down
2 changes: 1 addition & 1 deletion docs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ notes.md install-fortran.md credits.md auth.md filters.md \
obsolete/fan_utils.html indexing.dox inmemory.md FAQ.md \
known_problems.md COPYRIGHT.md inmeminternal.dox testserver.dox \
byterange.md nczarr.md quantize.md all-error-codes.md \
quickstart_paths.md cloud.md
quickstart_paths.md cloud.md threadsafe.md

# Turn off parallel builds in this directory.
.NOTPARALLEL:
Expand Down
4 changes: 2 additions & 2 deletions docs/nczarr.md
Original file line number Diff line number Diff line change
Expand Up @@ -611,12 +611,12 @@ There are mutiple cases to consider.
3. The netcdf attribute **is** of type NC_CHAR and its value – taken as a single sequence of characters –
**is** parseable as a legal JSON expression.
* Parse to produce a JSON expression and write that expression.
* Use "|U1" as the dtype and store in the NCZarr metadata.
* Use ">S1" as the dtype and store in the NCZarr metadata.

4. The netcdf attribute **is** of type NC_CHAR and its value – taken as a single sequence of characters –
**is not** parseable as a legal JSON expression.
* Convert to a JSON string and write that expression
* Use "|U1" as the dtype and store in the NCZarr metadata.
* Use ">S1" as the dtype and store in the NCZarr metadata.

## Reading an attribute:

Expand Down
Loading
Loading