diff -Nru ode-0.16/bindings/python/ode.pyx ode-0.16.2/bindings/python/ode.pyx --- ode-0.16/bindings/python/ode.pyx 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/bindings/python/ode.pyx 2020-07-30 13:26:48.000000000 +0000 @@ -690,7 +690,7 @@ where pos and normal are 3-tuples of floats and depth is a single float. geom1 and geom2 are the Geom objects of the geoms in contact. """ - cdef long id1, id2 + cdef size_t id1, id2 pos = (self._contact.geom.pos[0], self._contact.geom.pos[1], @@ -700,8 +700,8 @@ self._contact.geom.normal[2]) depth = self._contact.geom.depth - id1 = self._contact.geom.g1 - id2 = self._contact.geom.g2 + id1 = self._contact.geom.g1 + id2 = self._contact.geom.g2 g1 = _geom_c2py_lut[id1] g2 = _geom_c2py_lut[id2] return pos, normal, depth, g1, g2 @@ -724,7 +724,7 @@ @type geom2: Geom """ - cdef long id + cdef size_t id self._contact.geom.pos[0] = pos[0] self._contact.geom.pos[1] = pos[1] @@ -3461,8 +3461,8 @@ # return None def _id(self): - cdef long id - id = self.sid + cdef size_t id + id = self.sid return id def __len__(self): @@ -3525,11 +3525,11 @@ raise IndexError("geom index out of range") gid = dSpaceGetGeom(self.sid, idx) - if gid not in _geom_c2py_lut: + if gid not in _geom_c2py_lut: raise RuntimeError( "geom id cannot be translated to a Python object") - return _geom_c2py_lut[gid] + return _geom_c2py_lut[gid] def collide(self, arg, callback): """collide(arg, callback) @@ -3567,15 +3567,15 @@ cdef void collide_callback(void* data, dGeomID o1, dGeomID o2): cdef object tup # cdef Space space - cdef long id1, id2 + cdef size_t id1, id2 # if (dGeomGetBody(o1)==dGeomGetBody(o2)): # return tup = data callback, arg = tup - id1 = o1 - id2 = o2 + id1 = o1 + id2 = o2 g1 = _geom_c2py_lut[id1] g2 = _geom_c2py_lut[id2] callback(arg, g1, g2) @@ -3609,7 +3609,7 @@ self.gid = self.sid dSpaceSetCleanup(self.sid, 0) - _geom_c2py_lut[self.sid] = self + _geom_c2py_lut[self.sid] = self def __init__(self, space=None): pass @@ -3642,7 +3642,7 @@ self.gid = self.sid dSpaceSetCleanup(self.sid, 0) - _geom_c2py_lut[self.sid] = self + _geom_c2py_lut[self.sid] = self def __init__(self, space=None): pass @@ -3711,7 +3711,7 @@ self.gid = self.sid dSpaceSetCleanup(self.sid, 0) - _geom_c2py_lut[self.sid] = self + _geom_c2py_lut[self.sid] = self def __init__(self, center, extents, depth, space=None): pass @@ -3760,7 +3760,7 @@ # if space != None: # space._addgeom(self) - _geom_c2py_lut[self.gid] = self + _geom_c2py_lut[self.gid] = self def __init__(self, space=None, radius=1.0): self.space = space @@ -3770,8 +3770,8 @@ return True def _id(self): - cdef long id - id = self.gid + cdef size_t id + id = self.gid return id def setRadius(self, radius): @@ -3828,7 +3828,7 @@ # if space != None: # space._addgeom(self) - _geom_c2py_lut[self.gid] = self + _geom_c2py_lut[self.gid] = self def __init__(self, space=None, lengths=(1.0, 1.0, 1.0)): self.space = space @@ -3838,8 +3838,8 @@ return True def _id(self): - cdef long id - id = self.gid + cdef size_t id + id = self.gid return id def setLengths(self, lengths): @@ -3892,14 +3892,14 @@ # if space != None: # space._addgeom(self) - _geom_c2py_lut[self.gid] = self + _geom_c2py_lut[self.gid] = self def __init__(self, space=None, normal=(0, 0, 1), dist=0): self.space = space def _id(self): - cdef long id - id = self.gid + cdef size_t id + id = self.gid return id def setParams(self, normal, dist): @@ -3950,7 +3950,7 @@ # if space != None: # space._addgeom(self) - _geom_c2py_lut[self.gid] = self + _geom_c2py_lut[self.gid] = self def __init__(self, space=None, radius=0.5, length=1.0): self.space = space @@ -3960,8 +3960,8 @@ return True def _id(self): - cdef long id - id = self.gid + cdef size_t id + id = self.gid return id def setParams(self, radius, length): @@ -4012,7 +4012,7 @@ # if space != None: # space._addgeom(self) - _geom_c2py_lut[self.gid] = self + _geom_c2py_lut[self.gid] = self def __init__(self, space=None, radius=0.5, length=1.0): self.space = space @@ -4022,8 +4022,8 @@ return True def _id(self): - cdef long id - id = self.gid + cdef size_t id + id = self.gid return id def setParams(self, radius, length): @@ -4064,15 +4064,15 @@ # if space != None: # space._addgeom(self) - _geom_c2py_lut[self.gid] = self + _geom_c2py_lut[self.gid] = self def __init__(self, space=None, rlen=1.0): self.space = space self.body = None def _id(self): - cdef long id - id = self.gid + cdef size_t id + id = self.gid return id def placeable(self): @@ -4149,7 +4149,7 @@ # if space != None: # space._addgeom(self) - _geom_c2py_lut[self.gid] = self + _geom_c2py_lut[self.gid] = self def __init__(self, space=None): self.space = space @@ -4162,8 +4162,8 @@ return True def _id(self): - cdef long id - id = self.gid + cdef size_t id + id = self.gid return id def setGeom(self, GeomObject geom not None): @@ -4177,7 +4177,7 @@ @param geom: Geom object to encapsulate @type geom: GeomObject """ - cdef long id + cdef size_t id if not geom.placeable(): raise ValueError( @@ -4335,7 +4335,7 @@ sid = sp.sid self.gid = dCreateTriMesh(sid, data.tmdid, NULL, NULL, NULL) - _geom_c2py_lut[self.gid] = self + _geom_c2py_lut[self.gid] = self def __init__(self, TriMeshData data not None, space=None): self.space = space @@ -4345,8 +4345,8 @@ return True def _id(self): - cdef long id - id = self.gid + cdef size_t id + id = self.gid return id def clearTCCache(self): @@ -4415,8 +4415,8 @@ """ cdef dContactGeom c[150] - cdef long id1 - cdef long id2 + cdef size_t id1 + cdef size_t id2 cdef int i, n cdef Contact cont @@ -4451,8 +4451,8 @@ """ cdef void* data cdef object tup - cdef long id1 - cdef long id2 + cdef size_t id1 + cdef size_t id2 id1 = geom1._id() id2 = geom2._id() diff -Nru ode-0.16/build/premake4.lua ode-0.16.2/build/premake4.lua --- ode-0.16/build/premake4.lua 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/build/premake4.lua 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ -- For more information on Premake: http://industriousone.com/premake ---------------------------------------------------------------------- - ode_version = "0.16" + ode_version = "0.16.2" ---------------------------------------------------------------------- -- Demo list: add/remove demos from here and the rest of the build @@ -333,6 +333,7 @@ if os.get() == "windows" then buildoptions { "-mthreads" } linkoptions { "-mthreads" } + defines { "HAVE_PTHREAD_ATTR_SETINHERITSCHED=1", "HAVE_PTHREAD_ATTR_SETSTACKLAZY=1" } else buildoptions { "-pthread" } linkoptions { "-pthread" } diff -Nru ode-0.16/CHANGELOG.txt ode-0.16.2/CHANGELOG.txt --- ode-0.16/CHANGELOG.txt 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/CHANGELOG.txt 2020-07-30 13:27:35.000000000 +0000 @@ -8,6 +8,12 @@ * keep the format consistent (79 char width, M/D/Y date format). ------------------------------------------------------------------------------ +07/28/2020 Oleh Derevenko + * A threaded job data race fixed on job release (issue #70). + The bug could cause writes to functions's stack area after + the function returned and World simulation errors not being reported + with the function result if the simulation failed. + 11/12/2018 Oleh Derevenko * The commentary from 11/05/2018 was wrong. The constraints were not reset to their natural order and remained randomized. diff -Nru ode-0.16/CMakeLists.txt ode-0.16.2/CMakeLists.txt --- ode-0.16/CMakeLists.txt 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/CMakeLists.txt 2020-07-30 13:27:35.000000000 +0000 @@ -9,7 +9,7 @@ set(VERSION_MAJOR 0) set(VERSION_MINOR 16) -set(VERSION_PATCH 0) +set(VERSION_PATCH 2) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) option(BUILD_SHARED_LIBS "Build shared libraries." ON) diff -Nru ode-0.16/configure ode-0.16.2/configure --- ode-0.16/configure 2018-12-09 20:06:11.000000000 +0000 +++ ode-0.16.2/configure 2020-07-30 13:28:42.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for ODE 0.16. +# Generated by GNU Autoconf 2.69 for ODE 0.16.2. # # Report bugs to . # @@ -589,8 +589,8 @@ # Identity of this package. PACKAGE_NAME='ODE' PACKAGE_TARNAME='ode' -PACKAGE_VERSION='0.16' -PACKAGE_STRING='ODE 0.16' +PACKAGE_VERSION='0.16.2' +PACKAGE_STRING='ODE 0.16.2' PACKAGE_BUGREPORT='ode@ode.org' PACKAGE_URL='' @@ -1426,7 +1426,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures ODE 0.16 to adapt to many kinds of systems. +\`configure' configures ODE 0.16.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1497,7 +1497,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ODE 0.16:";; + short | recursive ) echo "Configuration of ODE 0.16.2:";; esac cat <<\_ACEOF @@ -1662,7 +1662,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ODE configure 0.16 +ODE configure 0.16.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2336,7 +2336,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by ODE $as_me 0.16, which was +It was created by ODE $as_me 0.16.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2684,7 +2684,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -ODE_VERSION=0.16 +ODE_VERSION=0.16.2 # Those are instructions from the Libtool manual: @@ -2707,7 +2707,7 @@ # 6. If any interfaces have been removed since the last public release, # then set AGE to 0. CURRENT=8 -REVISION=0 +REVISION=2 AGE=0 # Check whether --enable-version-info was given. @@ -3316,7 +3316,7 @@ # Define the identity of the package. PACKAGE='ode' - VERSION='0.16' + VERSION='0.16.2' cat >>confdefs.h <<_ACEOF @@ -18071,7 +18071,7 @@ fi -for ac_func in atan2f clock_gettime copysign copysignf cosf fabsf floor fmodf gettimeofday isnan _isnan __isnan isnanf _isnanf __isnanf memmove memset pthread_attr_setstacklazy pthread_condattr_setclock sinf snprintf sqrt sqrtf strchr strstr vsnprintf +for ac_func in atan2f clock_gettime copysign copysignf cosf fabsf floor fmodf gettimeofday isnan _isnan __isnan isnanf _isnanf __isnanf memmove memset pthread_attr_setstacklazy pthread_attr_setinheritsched pthread_condattr_setclock sinf snprintf sqrt sqrtf strchr strstr vsnprintf do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -18270,6 +18270,26 @@ fi +ac_fn_c_check_func "$LINENO" "pthread_condattr_setclock" "ac_cv_func_pthread_condattr_setclock" +if test "x$ac_cv_func_pthread_condattr_setclock" = xyes; then : + +else + ac_cv_func_no_pthread_condattr_setclock=yes +fi + +for ac_func in no_pthread_condattr_setclock +do : + ac_fn_c_check_func "$LINENO" "no_pthread_condattr_setclock" "ac_cv_func_no_pthread_condattr_setclock" +if test "x$ac_cv_func_no_pthread_condattr_setclock" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NO_PTHREAD_CONDATTR_SETCLOCK 1 +_ACEOF + +fi +done + + + # Check whether --enable-threading-intf was given. if test "${enable_threading_intf+set}" = set; then : enableval=$enable_threading_intf; threading_intf=$enableval @@ -19335,7 +19355,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by ODE $as_me 0.16, which was +This file was extended by ODE $as_me 0.16.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -19401,7 +19421,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -ODE config.status 0.16 +ODE config.status 0.16.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru ode-0.16/configure.ac ode-0.16.2/configure.ac --- ode-0.16/configure.ac 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/configure.ac 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ dnl AC_INIT does not take a macro as a version nr: set it separately! - Bram -AC_INIT([ODE],[0.16],[ode@ode.org]) -ODE_VERSION=0.16 +AC_INIT([ODE],[0.16.2],[ode@ode.org]) +ODE_VERSION=0.16.2 AC_SUBST(ODE_VERSION) # Those are instructions from the Libtool manual: @@ -23,7 +23,7 @@ # 6. If any interfaces have been removed since the last public release, # then set AGE to 0. CURRENT=8 -REVISION=0 +REVISION=2 AGE=0 AC_ARG_ENABLE(version-info, @@ -285,9 +285,15 @@ AC_CHECK_LIB(m, [main]) AC_CHECK_LIB(sunmath, [main]) AC_CHECK_LIB(rt, [main]) -AC_CHECK_FUNCS([atan2f clock_gettime copysign copysignf cosf fabsf floor fmodf gettimeofday isnan _isnan __isnan isnanf _isnanf __isnanf memmove memset pthread_attr_setstacklazy pthread_condattr_setclock sinf snprintf sqrt sqrtf strchr strstr vsnprintf]) +AC_CHECK_FUNCS([atan2f clock_gettime copysign copysignf cosf fabsf floor fmodf gettimeofday isnan _isnan __isnan isnanf _isnanf __isnanf memmove memset pthread_attr_setstacklazy pthread_attr_setinheritsched pthread_condattr_setclock sinf snprintf sqrt sqrtf strchr strstr vsnprintf]) AC_FUNC_ALLOCA +dnl This trick allows having additional define in case if a function is not found. +dnl It fakes cached value for an inexistent function which is then used to fool function check to produce desired result. +AC_CHECK_FUNC(pthread_condattr_setclock,,ac_cv_func_no_pthread_condattr_setclock=yes) +AC_CHECK_FUNCS(no_pthread_condattr_setclock) + + AC_ARG_ENABLE([threading-intf], AS_HELP_STRING([--disable-threading-intf], [disable threading interface support (external implementations cannot be assigned)] diff -Nru ode-0.16/debian/changelog ode-0.16.2/debian/changelog --- ode-0.16/debian/changelog 2020-03-22 15:52:23.000000000 +0000 +++ ode-0.16.2/debian/changelog 2020-12-24 15:46:10.000000000 +0000 @@ -1,8 +1,14 @@ -ode (2:0.16-3build1) focal; urgency=medium +ode (2:0.16.2-1) unstable; urgency=medium - * No-change rebuild for libgcc-s1 package name change. + * New upstream version. Fix some issues by upstream. + * Update watch file standard. No changes. + * Update Standards and debhelper-compat. No changes. + * Added R³ rule. + * Rebase patches. Applied by upstream. + * Added not-installed file to manage libode.la file. + * Drop debian/patches reference. - -- Matthias Klose Sun, 22 Mar 2020 16:52:23 +0100 + -- Leopold Palomo-Avellaneda Thu, 24 Dec 2020 16:46:10 +0100 ode (2:0.16-3) unstable; urgency=medium diff -Nru ode-0.16/debian/compat ode-0.16.2/debian/compat --- ode-0.16/debian/compat 2018-12-17 07:48:10.000000000 +0000 +++ ode-0.16.2/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -11 diff -Nru ode-0.16/debian/control ode-0.16.2/debian/control --- ode-0.16/debian/control 2019-01-13 11:26:09.000000000 +0000 +++ ode-0.16.2/debian/control 2020-12-24 15:46:10.000000000 +0000 @@ -4,10 +4,11 @@ Maintainer: Debian Games Team Uploaders: Barry deFreese , Leopold Palomo-Avellaneda -Build-Depends: debhelper (>= 11~), docbook-to-man, +Build-Depends: debhelper-compat (= 13), docbook-to-man, libglu1-mesa-dev | libglu-dev, libgl1-mesa-dev | libgl-dev, libccd-dev, pkg-config -Standards-Version: 4.2.1 +Standards-Version: 4.5.1 +Rules-Requires-Root: no Vcs-Browser: https://salsa.debian.org/games-team/ode Vcs-Git: https://salsa.debian.org/games-team/ode.git Homepage: http://www.ode.org/ diff -Nru ode-0.16/debian/copyright ode-0.16.2/debian/copyright --- ode-0.16/debian/copyright 2019-01-13 11:09:27.000000000 +0000 +++ ode-0.16.2/debian/copyright 2020-12-24 15:46:10.000000000 +0000 @@ -354,7 +354,3 @@ 2013 Jon Dowland 2014-2019 Leopold Palomo-Avellaneda License: BSD-3-Clause - -Files: debian/patches/* -Copyright: 2019 Oleh Derevenko, E-mail: oder@eleks.com -License: BSD-3-Clause or LGPL-2.1+ \ No newline at end of file diff -Nru ode-0.16/debian/.gitlab-ci.yml ode-0.16.2/debian/.gitlab-ci.yml --- ode-0.16/debian/.gitlab-ci.yml 2018-11-17 20:32:11.000000000 +0000 +++ ode-0.16.2/debian/.gitlab-ci.yml 2020-12-24 15:46:10.000000000 +0000 @@ -1,16 +1,3 @@ -include: https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml - -build: - extends: .build-unstable - -reprotest: - extends: .test-reprotest - -lintian: - extends: .test-lintian - -autopkgtest: - extends: .test-autopkgtest - -piuparts: - extends: .test-piuparts +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml diff -Nru ode-0.16/debian/not-installed ode-0.16.2/debian/not-installed --- ode-0.16/debian/not-installed 1970-01-01 00:00:00.000000000 +0000 +++ ode-0.16.2/debian/not-installed 2020-12-24 15:46:10.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/*/libode.la diff -Nru ode-0.16/debian/patches/patch1-96154db.patch ode-0.16.2/debian/patches/patch1-96154db.patch --- ode-0.16/debian/patches/patch1-96154db.patch 2019-01-13 09:23:47.000000000 +0000 +++ ode-0.16.2/debian/patches/patch1-96154db.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -# HG changeset patch -# User oleh-derevenko -# Date 1547341015 -7200 -# Node ID 96154dbbff9437c721130272f6f20584b5ec96d8 -# Parent 7755c9d58f8bb0eaf2592a49c209d4d9817e3f8e -Fixed: String formatting arguments/types fixed to match in the libccd tests - -diff --git a/libccd/src/testsuites/bench.c b/libccd/src/testsuites/bench.c ---- a/libccd/src/testsuites/bench.c -+++ b/libccd/src/testsuites/bench.c -@@ -246,7 +246,7 @@ - cycles = atol(argv[1]); - } - -- fprintf(stdout, "Cycles: %u\n", cycles); -+ fprintf(stdout, "Cycles: %zu\n", cycles); - fprintf(stdout, "\n"); - - boxbox(); -diff --git a/libccd/src/testsuites/bench2.c b/libccd/src/testsuites/bench2.c ---- a/libccd/src/testsuites/bench2.c -+++ b/libccd/src/testsuites/bench2.c -@@ -252,7 +252,7 @@ - cycles = atol(argv[1]); - } - -- fprintf(stdout, "Cycles: %u\n", cycles); -+ fprintf(stdout, "Cycles: %zu\n", cycles); - fprintf(stdout, "\n"); - - boxbox(); -diff --git a/libccd/src/testsuites/common.c b/libccd/src/testsuites/common.c ---- a/libccd/src/testsuites/common.c -+++ b/libccd/src/testsuites/common.c -@@ -9,7 +9,7 @@ - ccd_quat_t rot; - ccd_vec3_t axis, vpos, vpos2; - ccd_real_t angle, x, y; -- size_t i; -+ unsigned int i; - - ccdVec3Set(&axis, 0., 0., 1.); - ccdVec3Set(&vpos, 0., c->radius, 0.); -diff --git a/libccd/src/testsuites/polytope.c b/libccd/src/testsuites/polytope.c ---- a/libccd/src/testsuites/polytope.c -+++ b/libccd/src/testsuites/polytope.c -@@ -101,7 +101,7 @@ - ccd_pt_face_t *f[4]; - ccd_vec3_t u; - int res; -- size_t i; -+ unsigned int i; - - DBG2("------"); - diff -Nru ode-0.16/debian/patches/patch2-3262016.patch ode-0.16.2/debian/patches/patch2-3262016.patch --- ode-0.16/debian/patches/patch2-3262016.patch 2019-01-13 09:25:00.000000000 +0000 +++ ode-0.16.2/debian/patches/patch2-3262016.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -# HG changeset patch -# User oleh-derevenko -# Date 1547341082 -7200 -# Node ID 3262016ef92b4925253411592270c10899e9c652 -# Parent 96154dbbff9437c721130272f6f20584b5ec96d8 -Fixed: atomicord32 type signedness fixed for mutex-aided atomics implementation - -diff --git a/ou/include/ou/atomic.h b/ou/include/ou/atomic.h ---- a/ou/include/ou/atomic.h -+++ b/ou/include/ou/atomic.h -@@ -1630,7 +1630,7 @@ - BEGIN_NAMESPACE_OU(); - - --typedef int32_t atomicord32; -+typedef uint32_t atomicord32; - typedef void *atomicptr; - - diff -Nru ode-0.16/debian/patches/patch3-ea98ff1.patch ode-0.16.2/debian/patches/patch3-ea98ff1.patch --- ode-0.16/debian/patches/patch3-ea98ff1.patch 2019-01-13 12:41:54.000000000 +0000 +++ ode-0.16.2/debian/patches/patch3-ea98ff1.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -# HG changeset patch -# User oleh-derevenko -# Date 1547341122 -7200 -# Node ID ea98ff157e843bdee7c7c4eee773bdf04d274bae -# Parent 3262016ef92b4925253411592270c10899e9c652 -Fixed: Some more architectures support added for Debian builds - -diff --git a/include/ode/odeconfig.h b/include/ode/odeconfig.h ---- a/include/ode/odeconfig.h -+++ b/include/ode/odeconfig.h -@@ -80,8 +80,10 @@ - #endif // #if !defined(__GNUC__) - - --/* Well-defined common data types...need to define for 64 bit systems */ --#if defined(__aarch64__) -+/* Well-defined common data types...need to be defined for 64 bit systems */ -+#if defined(__aarch64__) || defined(__alpha__) || defined(__ppc64__) \ -+ || defined(__s390__) || defined(__s390x__) || defined(__zarch__) \ -+ || defined(__mips__) || defined(__powerpc64__) || defined(__riscv) || defined(__sparc64__) || defined(__sparc__) - #include - typedef int64_t dint64; - typedef uint64_t duint64; -@@ -97,13 +99,13 @@ - typedef ptrdiff_t ddiffint; - typedef size_t dsizeint; - --#elif defined(_M_IA64) || defined(__ia64__) || defined(_M_AMD64) || defined(__x86_64__) -+#elif (defined(_M_IA64) || defined(__ia64__) || defined(_M_AMD64) || defined(__x86_64__)) && !defined(__ILP32__) && !defined(_ILP32) - #define X86_64_SYSTEM 1 - #if defined(_MSC_VER) - typedef __int64 dint64; - typedef unsigned __int64 duint64; - #else --#if defined(_LP64) -+#if defined(_LP64) || defined(__LP64__) - typedef long dint64; - typedef unsigned long duint64; - #else diff -Nru ode-0.16/debian/patches/series ode-0.16.2/debian/patches/series --- ode-0.16/debian/patches/series 2019-01-13 09:28:10.000000000 +0000 +++ ode-0.16.2/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -patch1-96154db.patch -patch2-3262016.patch -patch3-ea98ff1.patch diff -Nru ode-0.16/debian/watch ode-0.16.2/debian/watch --- ode-0.16/debian/watch 2018-12-17 08:48:18.000000000 +0000 +++ ode-0.16.2/debian/watch 2020-12-24 15:46:10.000000000 +0000 @@ -1,3 +1,3 @@ -version=3 +version=4 https://bitbucket.org/odedevs/ode/downloads/ode-(.*)\.tar\.gz diff -Nru ode-0.16/include/ode/odeconfig.h ode-0.16.2/include/ode/odeconfig.h --- ode-0.16/include/ode/odeconfig.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/include/ode/odeconfig.h 2020-07-30 13:27:35.000000000 +0000 @@ -80,8 +80,11 @@ #endif // #if !defined(__GNUC__) -/* Well-defined common data types...need to define for 64 bit systems */ -#if defined(__aarch64__) +/* Well-defined common data types...need to be defined for 64 bit systems */ +#if defined(__aarch64__) || defined(__alpha__) || defined(__ppc64__) \ + || defined(__s390__) || defined(__s390x__) || defined(__zarch__) \ + || defined(__mips__) || defined(__powerpc64__) || defined(__riscv) \ + || (defined(__sparc__) && defined(__arch64__)) #include typedef int64_t dint64; typedef uint64_t duint64; @@ -97,13 +100,13 @@ typedef ptrdiff_t ddiffint; typedef size_t dsizeint; -#elif defined(_M_IA64) || defined(__ia64__) || defined(_M_AMD64) || defined(__x86_64__) +#elif (defined(_M_IA64) || defined(__ia64__) || defined(_M_AMD64) || defined(__x86_64__)) && !defined(__ILP32__) && !defined(_ILP32) #define X86_64_SYSTEM 1 #if defined(_MSC_VER) typedef __int64 dint64; typedef unsigned __int64 duint64; #else -#if defined(_LP64) +#if defined(_LP64) || defined(__LP64__) typedef long dint64; typedef unsigned long duint64; #else diff -Nru ode-0.16/include/ode/precision.h ode-0.16.2/include/ode/precision.h --- ode-0.16/include/ode/precision.h 2018-12-09 20:06:23.000000000 +0000 +++ ode-0.16.2/include/ode/precision.h 2020-07-30 13:28:56.000000000 +0000 @@ -10,7 +10,7 @@ #elif defined(dIDEDOUBLE) #define dDOUBLE #else -#define dDOUBLE +#define dSINGLE #endif #endif diff -Nru ode-0.16/include/ode/threading.h ode-0.16.2/include/ode/threading.h --- ode-0.16/include/ode/threading.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/include/ode/threading.h 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading support header file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/include/ode/threading_impl.h ode-0.16.2/include/ode/threading_impl.h --- ode-0.16/include/ode/threading_impl.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/include/ode/threading_impl.h 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Builtin ODE threading implementation header. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/include/ode/version.h ode-0.16.2/include/ode/version.h --- ode-0.16/include/ode/version.h 2018-12-09 20:06:23.000000000 +0000 +++ ode-0.16.2/include/ode/version.h 2020-07-30 13:28:56.000000000 +0000 @@ -1,6 +1,6 @@ #ifndef _ODE_VERSION_H_ #define _ODE_VERSION_H_ -#define dODE_VERSION "0.16" +#define dODE_VERSION "0.16.2" #endif diff -Nru ode-0.16/libccd/src/testsuites/bench2.c ode-0.16.2/libccd/src/testsuites/bench2.c --- ode-0.16/libccd/src/testsuites/bench2.c 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/libccd/src/testsuites/bench2.c 2020-07-30 13:26:48.000000000 +0000 @@ -252,7 +252,7 @@ cycles = atol(argv[1]); } - fprintf(stdout, "Cycles: %u\n", cycles); + fprintf(stdout, "Cycles: %zu\n", cycles); fprintf(stdout, "\n"); boxbox(); diff -Nru ode-0.16/libccd/src/testsuites/bench.c ode-0.16.2/libccd/src/testsuites/bench.c --- ode-0.16/libccd/src/testsuites/bench.c 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/libccd/src/testsuites/bench.c 2020-07-30 13:26:48.000000000 +0000 @@ -246,7 +246,7 @@ cycles = atol(argv[1]); } - fprintf(stdout, "Cycles: %u\n", cycles); + fprintf(stdout, "Cycles: %zu\n", cycles); fprintf(stdout, "\n"); boxbox(); diff -Nru ode-0.16/libccd/src/testsuites/common.c ode-0.16.2/libccd/src/testsuites/common.c --- ode-0.16/libccd/src/testsuites/common.c 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/libccd/src/testsuites/common.c 2020-07-30 13:26:48.000000000 +0000 @@ -9,7 +9,7 @@ ccd_quat_t rot; ccd_vec3_t axis, vpos, vpos2; ccd_real_t angle, x, y; - size_t i; + unsigned int i; ccdVec3Set(&axis, 0., 0., 1.); ccdVec3Set(&vpos, 0., c->radius, 0.); diff -Nru ode-0.16/libccd/src/testsuites/polytope.c ode-0.16.2/libccd/src/testsuites/polytope.c --- ode-0.16/libccd/src/testsuites/polytope.c 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/libccd/src/testsuites/polytope.c 2020-07-30 13:26:48.000000000 +0000 @@ -101,7 +101,7 @@ ccd_pt_face_t *f[4]; ccd_vec3_t u; int res; - size_t i; + unsigned int i; DBG2("------"); diff -Nru ode-0.16/ode/demo/demo_collision.cpp ode-0.16.2/ode/demo/demo_collision.cpp --- ode-0.16/ode/demo/demo_collision.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/demo/demo_collision.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -1027,31 +1027,57 @@ static int edgeIntersectsRect (dVector3 v1, dVector3 v2, dVector3 p1, dVector3 p2, dVector3 p3) { - int k; - dVector3 u1,u2,n,tmp; - for (k=0; k<3; k++) u1[k] = p3[k]-p1[k]; - for (k=0; k<3; k++) u2[k] = p2[k]-p1[k]; - dReal d1 = dSqrt(dCalcVectorDot3(u1,u1)); - dReal d2 = dSqrt(dCalcVectorDot3(u2,u2)); - dNormalize3 (u1); - dNormalize3 (u2); - if (dFabs(dCalcVectorDot3(u1,u2)) > 1e-6) dDebug (0,"bad u1/u2"); - dCalcVectorCross3(n,u1,u2); - for (k=0; k<3; k++) tmp[k] = v2[k]-v1[k]; - dReal d = -dCalcVectorDot3(n,p1); - if (dFabs(dCalcVectorDot3(n,p1)+d) > 1e-8) dDebug (0,"bad n wrt p1"); - if (dFabs(dCalcVectorDot3(n,p2)+d) > 1e-8) dDebug (0,"bad n wrt p2"); - if (dFabs(dCalcVectorDot3(n,p3)+d) > 1e-8) dDebug (0,"bad n wrt p3"); - dReal alpha = -(d+dCalcVectorDot3(n,v1))/dCalcVectorDot3(n,tmp); - for (k=0; k<3; k++) tmp[k] = v1[k]+alpha*(v2[k]-v1[k]); - if (dFabs(dCalcVectorDot3(n,tmp)+d) > 1e-6) dDebug (0,"bad tmp"); - if (alpha < 0) return 0; - if (alpha > 1) return 0; - for (k=0; k<3; k++) tmp[k] -= p1[k]; - dReal a1 = dCalcVectorDot3(u1,tmp); - dReal a2 = dCalcVectorDot3(u2,tmp); - if (a1<0 || a2<0 || a1>d1 || a2>d2) return 0; - return 1; + int k; + dVector3 u1, u2, n, tmp; + + for (k=0; k < 3; k++) u1[k] = p3[k] - p1[k]; + for (k=0; k < 3; k++) u2[k] = p2[k] - p1[k]; + + dReal d1 = dSqrt(dCalcVectorDot3(u1, u1)); + dReal d2 = dSqrt(dCalcVectorDot3(u2, u2)); + dNormalize3(u1); + dNormalize3(u2); + + dReal error; +#ifdef dSINGLE + const dReal uEpsilon = 1e-5, pEpsilon = 1e-6, tmpEpsilon = 1.5e-4; +#else + const dReal uEpsilon = 1e-6, pEpsilon = 1e-8, tmpEpsilon = 1e-6; +#endif + + error = dFabs(dCalcVectorDot3(u1, u2)); + if (error > uEpsilon) dDebug(0, "bad u1/u2"); + + dCalcVectorCross3(n, u1, u2); + + for (k=0; k < 3; k++) tmp[k] = v2[k] - v1[k]; + + dReal d = -dCalcVectorDot3(n, p1); + + error = dFabs(dCalcVectorDot3(n, p1) + d); + if (error > pEpsilon) dDebug(0, "bad n wrt p1"); + + error = dFabs(dCalcVectorDot3(n, p2) + d); + if (error > pEpsilon) dDebug(0, "bad n wrt p2"); + + error = dFabs(dCalcVectorDot3(n, p3) + d); + if (error > pEpsilon) dDebug(0, "bad n wrt p3"); + + dReal alpha = -(d + dCalcVectorDot3(n, v1)) / dCalcVectorDot3(n, tmp); + for (k=0; k < 3; k++) tmp[k] = v1[k] + alpha * (v2[k] - v1[k]); + + error = dFabs(dCalcVectorDot3(n, tmp) + d); + if (error > tmpEpsilon) dDebug(0, "bad tmp"); + + if (alpha < 0) return 0; + if (alpha > 1) return 0; + + for (k=0; k < 3; k++) tmp[k] -= p1[k]; + dReal a1 = dCalcVectorDot3(u1, tmp); + dReal a2 = dCalcVectorDot3(u2, tmp); + if (a1 < 0 || a2 < 0 || a1 > d1 || a2 > d2) return 0; + + return 1; } diff -Nru ode-0.16/ode/doc/Makefile.in ode-0.16.2/ode/doc/Makefile.in --- ode-0.16/ode/doc/Makefile.in 2018-12-09 20:06:11.000000000 +0000 +++ ode-0.16.2/ode/doc/Makefile.in 2020-07-30 13:28:42.000000000 +0000 @@ -374,8 +374,8 @@ maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -@HAVE_DOXYGEN_FALSE@html-local: @HAVE_DOXYGEN_FALSE@mostlyclean-local: +@HAVE_DOXYGEN_FALSE@html-local: clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am diff -Nru ode-0.16/ode/src/collision_quadtreespace.cpp ode-0.16.2/ode/src/collision_quadtreespace.cpp --- ode-0.16/ode/src/collision_quadtreespace.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/collision_quadtreespace.cpp 2020-07-30 13:26:48.000000000 +0000 @@ -265,15 +265,21 @@ void Block::DelObject(dGeomID Object){ // Del the geom - dxGeom* g = mFirst; - dxGeom* Last = 0; - while (g){ - if (g == Object){ - if (Last){ - Last->next_ex = g->next_ex; - } - else mFirst = g->next_ex; + dxGeom *Last, *g = mFirst; + bool Found = false; + if (g == Object){ + mFirst = g->next_ex; + Found = true; + } + else { + Last = g; + g = g->next_ex; + } + + for (; !Found && g; Found = false){ + if (g == Object){ + Last->next_ex = g->next_ex; break; } Last = g; @@ -281,6 +287,7 @@ } Object->tome_ex = 0; + dUASSERT((Object->next_ex = 0, true), "Needed for an assertion check only"); // Now traverse upwards to tell that we have lost a geom Block* Block = this; diff -Nru ode-0.16/ode/src/collision_sapspace.cpp ode-0.16.2/ode/src/collision_sapspace.cpp --- ode-0.16/ode/src/collision_sapspace.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/collision_sapspace.cpp 2020-07-30 13:26:48.000000000 +0000 @@ -351,6 +351,9 @@ GeomList.setSize( geomSize-1 ); } + g->tome_ex = 0; + dUASSERT((g->next_ex = 0, true), "Needed for an assertion check only"); + dxSpace::remove(g); } diff -Nru ode-0.16/ode/src/collision_trimesh_gimpact.h ode-0.16.2/ode/src/collision_trimesh_gimpact.h --- ode-0.16/ode/src/collision_trimesh_gimpact.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/collision_trimesh_gimpact.h 2020-07-30 13:27:35.000000000 +0000 @@ -23,7 +23,7 @@ // TriMesh code by Erwin de Vries. // Modified for FreeSOLID Compatibility by Rodrigo Hernandez // Trimesh caches separation by Oleh Derevenko -// TriMesh storage classes refactoring and face angle computation code by Oleh Derevenko (C) 2016-2017 +// TriMesh storage classes refactoring and face angle computation code by Oleh Derevenko (C) 2016-2019 #ifndef _ODE_COLLISION_TRIMESH_GIMPACT_H_ diff -Nru ode-0.16/ode/src/collision_trimesh_internal.cpp ode-0.16.2/ode/src/collision_trimesh_internal.cpp --- ode-0.16/ode/src/collision_trimesh_internal.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/collision_trimesh_internal.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -20,7 +20,7 @@ * * *************************************************************************/ -// TriMesh storage classes refactoring and face angle computation code by Oleh Derevenko (C) 2016-2017 +// TriMesh storage classes refactoring and face angle computation code by Oleh Derevenko (C) 2016-2019 #include #include diff -Nru ode-0.16/ode/src/collision_trimesh_internal.h ode-0.16.2/ode/src/collision_trimesh_internal.h --- ode-0.16/ode/src/collision_trimesh_internal.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/collision_trimesh_internal.h 2020-07-30 13:27:35.000000000 +0000 @@ -23,7 +23,7 @@ // TriMesh code by Erwin de Vries. // Modified for FreeSOLID Compatibility by Rodrigo Hernandez // TriMesh caches separation by Oleh Derevenko -// TriMesh storage classes refactoring and face angle computation code by Oleh Derevenko (C) 2016-2017 +// TriMesh storage classes refactoring and face angle computation code by Oleh Derevenko (C) 2016-2019 #ifndef _ODE_COLLISION_TRIMESH_INTERNAL_H_ diff -Nru ode-0.16/ode/src/collision_trimesh_internal_impl.h ode-0.16.2/ode/src/collision_trimesh_internal_impl.h --- ode-0.16/ode/src/collision_trimesh_internal_impl.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/collision_trimesh_internal_impl.h 2020-07-30 13:27:35.000000000 +0000 @@ -20,7 +20,7 @@ * * *************************************************************************/ -// TriMesh base template method implementations by Oleh Derevenko (C) 2016-2017 +// TriMesh base template method implementations by Oleh Derevenko (C) 2016-2019 #ifndef _ODE_COLLISION_TRIMESH_INTERNAL_IMPL_H_ diff -Nru ode-0.16/ode/src/collision_trimesh_opcode.cpp ode-0.16.2/ode/src/collision_trimesh_opcode.cpp --- ode-0.16/ode/src/collision_trimesh_opcode.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/collision_trimesh_opcode.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -21,7 +21,7 @@ *************************************************************************/ // TriMesh code by Erwin de Vries. -// TriMesh storage classes refactoring and face angle computation code by Oleh Derevenko (C) 2016-2017 +// TriMesh storage classes refactoring and face angle computation code by Oleh Derevenko (C) 2016-2019 #include #include diff -Nru ode-0.16/ode/src/collision_trimesh_opcode.h ode-0.16.2/ode/src/collision_trimesh_opcode.h --- ode-0.16/ode/src/collision_trimesh_opcode.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/collision_trimesh_opcode.h 2020-07-30 13:27:35.000000000 +0000 @@ -23,7 +23,7 @@ // TriMesh code by Erwin de Vries. // Modified for FreeSOLID Compatibility by Rodrigo Hernandez // Trimesh caches separation by Oleh Derevenko -// TriMesh storage classes refactoring and face angle computation code by Oleh Derevenko (C) 2016-2017 +// TriMesh storage classes refactoring and face angle computation code by Oleh Derevenko (C) 2016-2019 #ifndef _ODE_COLLISION_TRIMESH_OPCODE_H_ diff -Nru ode-0.16/ode/src/config.h.in ode-0.16.2/ode/src/config.h.in --- ode-0.16/ode/src/config.h.in 2018-12-09 20:06:10.000000000 +0000 +++ ode-0.16.2/ode/src/config.h.in 2020-07-30 13:28:41.000000000 +0000 @@ -104,9 +104,15 @@ /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET +/* Define to 1 if you have the `no_pthread_condattr_setclock' function. */ +#undef HAVE_NO_PTHREAD_CONDATTR_SETCLOCK + /* Define to 1 if libc includes obstacks. */ #undef HAVE_OBSTACK +/* Define to 1 if you have the `pthread_attr_setinheritsched' function. */ +#undef HAVE_PTHREAD_ATTR_SETINHERITSCHED + /* Define to 1 if you have the `pthread_attr_setstacklazy' function. */ #undef HAVE_PTHREAD_ATTR_SETSTACKLAZY diff -Nru ode-0.16/ode/src/coop_matrix_types.h ode-0.16.2/ode/src/coop_matrix_types.h --- ode-0.16/ode/src/coop_matrix_types.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/coop_matrix_types.h 2020-07-30 13:27:35.000000000 +0000 @@ -21,7 +21,7 @@ *************************************************************************/ // Cooperative matrix algorithm types -// Copyright (C) 2017 Oleh Derevenko (odar@eleks.com - change all "a" to "e") +// Copyright (C) 2017-2019 Oleh Derevenko (odar@eleks.com - change all "a" to "e") #ifndef _ODE_COOP_MATRIX_TYPES_H_ diff -Nru ode-0.16/ode/src/default_threading.cpp ode-0.16.2/ode/src/default_threading.cpp --- ode-0.16/ode/src/default_threading.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/default_threading.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading base wrapper class header file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * @@ -26,7 +26,7 @@ /* * The default threading instance holder class implementation - * Copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ diff -Nru ode-0.16/ode/src/default_threading.h ode-0.16.2/ode/src/default_threading.h --- ode-0.16/ode/src/default_threading.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/default_threading.h 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading base wrapper class header file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * @@ -26,7 +26,7 @@ /* * A default threading instance holder class definition - * Copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ diff -Nru ode-0.16/ode/src/fastldltfactor.cpp ode-0.16.2/ode/src/fastldltfactor.cpp --- ode-0.16/ode/src/fastldltfactor.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/fastldltfactor.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -22,7 +22,7 @@ /* * LDLT factorization related code of ThreadedEquationSolverLDLT - * Copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ diff -Nru ode-0.16/ode/src/fastldltfactor_impl.h ode-0.16.2/ode/src/fastldltfactor_impl.h --- ode-0.16/ode/src/fastldltfactor_impl.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/fastldltfactor_impl.h 2020-07-30 13:27:35.000000000 +0000 @@ -23,8 +23,8 @@ *************************************************************************/ /* - * Code style improvements and optimizations by Oleh Derevenko ????-2017 - * LDLT cooperative factorization code of ThreadedEquationSolverLDLT copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Code style improvements and optimizations by Oleh Derevenko ????-2019 + * LDLT cooperative factorization code of ThreadedEquationSolverLDLT copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ #ifndef _ODE_FASTLDLT_IMPL_H_ diff -Nru ode-0.16/ode/src/fastldltsolve.cpp ode-0.16.2/ode/src/fastldltsolve.cpp --- ode-0.16/ode/src/fastldltsolve.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/fastldltsolve.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -22,7 +22,7 @@ /* * LDLT solving related code of ThreadedEquationSolverLDLT - * Copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ #include diff -Nru ode-0.16/ode/src/fastlsolve.cpp ode-0.16.2/ode/src/fastlsolve.cpp --- ode-0.16/ode/src/fastlsolve.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/fastlsolve.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -22,7 +22,7 @@ /* * L1Straight Equation Solving Routines - * Copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ #include diff -Nru ode-0.16/ode/src/fastlsolve_impl.h ode-0.16.2/ode/src/fastlsolve_impl.h --- ode-0.16/ode/src/fastlsolve_impl.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/fastlsolve_impl.h 2020-07-30 13:27:35.000000000 +0000 @@ -23,8 +23,8 @@ *************************************************************************/ /* - * Code style improvements and optimizations by Oleh Derevenko ????-2017 - * L1Straight cooperative solving code of ThreadedEquationSolverLDLT copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Code style improvements and optimizations by Oleh Derevenko ????-2019 + * L1Straight cooperative solving code of ThreadedEquationSolverLDLT copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ #ifndef _ODE_FASTLSOLVE_IMPL_H_ diff -Nru ode-0.16/ode/src/fastltsolve.cpp ode-0.16.2/ode/src/fastltsolve.cpp --- ode-0.16/ode/src/fastltsolve.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/fastltsolve.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -22,7 +22,7 @@ /* * L1Transposed Equation Solving Routines - * Copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ #include diff -Nru ode-0.16/ode/src/fastltsolve_impl.h ode-0.16.2/ode/src/fastltsolve_impl.h --- ode-0.16/ode/src/fastltsolve_impl.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/fastltsolve_impl.h 2020-07-30 13:27:35.000000000 +0000 @@ -23,8 +23,8 @@ *************************************************************************/ /* - * Code style improvements and optimizations by Oleh Derevenko ????-2017 - * L1Transposed cooperative solving code of ThreadedEquationSolverLDLT copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Code style improvements and optimizations by Oleh Derevenko ????-2019 + * L1Transposed cooperative solving code of ThreadedEquationSolverLDLT copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ diff -Nru ode-0.16/ode/src/fastvecscale.cpp ode-0.16.2/ode/src/fastvecscale.cpp --- ode-0.16/ode/src/fastvecscale.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/fastvecscale.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -22,7 +22,7 @@ /* * Vector scaling related code of ThreadedEquationSolverLDLT - * Copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ diff -Nru ode-0.16/ode/src/fastvecscale_impl.h ode-0.16.2/ode/src/fastvecscale_impl.h --- ode-0.16/ode/src/fastvecscale_impl.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/fastvecscale_impl.h 2020-07-30 13:27:35.000000000 +0000 @@ -22,7 +22,7 @@ /* * Vector scaling function implementation - * Improvements and cooperative implementation copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Improvements and cooperative implementation copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ #ifndef _ODE_FASTVECSCALE_IMPL_H_ diff -Nru ode-0.16/ode/src/joints/pu.cpp ode-0.16.2/ode/src/joints/pu.cpp --- ode-0.16/ode/src/joints/pu.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/joints/pu.cpp 2020-07-30 13:26:48.000000000 +0000 @@ -140,12 +140,15 @@ // anchor point. // r will be used to find the distance between body1 and the anchor point - dVector3 r; - dVector3 anchor2 = {0,0,0}; + dVector3 r, anchor2; + if ( joint->node[1].body ) { // Find joint->anchor2 in global coordinates - dMultiply0_331( anchor2, joint->node[1].body->posr.R, joint->anchor2 ); + + // NOTE! anchor2 needs a volatile assignment on the multiplication to discard computation errors. + // Otherwise, tests fail for single type on x86. + dxTruncToType::dMultiply0_331(anchor2, joint->node[1].body->posr.R, joint->anchor2); r[0] = ( joint->node[0].body->posr.pos[0] - ( anchor2[0] + joint->node[1].body->posr.pos[0] ) ); @@ -156,6 +159,8 @@ } else { + dZeroVector3(anchor2); + //N.B. When there is no body 2 the joint->anchor2 is already in // global coordinates // r = joint->node[0].body->posr.pos - joint->anchor2; diff -Nru ode-0.16/ode/src/odemath.h ode-0.16.2/ode/src/odemath.h --- ode-0.16/ode/src/odemath.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/odemath.h 2020-07-30 13:26:48.000000000 +0000 @@ -69,4 +69,29 @@ #define dOrthogonalizeR(m) dxOrthogonalizeR(m) +////////////////////////////////////////////////////////////////////////// + +namespace dxTruncToType +{ + +ODE_PURE_INLINE +void _dMultiplyHelper0_331(volatile dReal *res, const dReal *a, const dReal *b) +{ + const dReal res_0 = dCalcVectorDot3(a, b); + const dReal res_1 = dCalcVectorDot3(a + 4, b); + const dReal res_2 = dCalcVectorDot3(a + 8, b); + /* Only assign after all the calculations are over to avoid incurring memory aliasing*/ + res[0] = res_0; res[1] = res_1; res[2] = res_2; +} + +ODE_PURE_INLINE +void dMultiply0_331(volatile dReal *res, const dReal *a, const dReal *b) +{ + _dMultiplyHelper0_331(res, a, b); +} + + +}; // namespace dxTruncToType + + #endif diff -Nru ode-0.16/ode/src/odeou.cpp ode-0.16.2/ode/src/odeou.cpp --- ode-0.16/ode/src/odeou.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/odeou.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -1,7 +1,7 @@ /************************************************************************* * * * OU library interface file for Open Dynamics Engine, * - * Copyright (C) 2008 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2008-2019 Oleh Derevenko. All rights reserved. * * Email: odar@eleks.com (change all "a" to "e") * * * * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * diff -Nru ode-0.16/ode/src/odeou.h ode-0.16.2/ode/src/odeou.h --- ode-0.16/ode/src/odeou.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/odeou.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,7 +1,7 @@ /************************************************************************* * * * OU library interface file for Open Dynamics Engine, * -* Copyright (C) 2008 Oleh Derevenko. All rights reserved. * +* Copyright (C) 2008-2019 Oleh Derevenko. All rights reserved. * * Email: odar@eleks.com (change all "a" to "e") * * * * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * diff -Nru ode-0.16/ode/src/odetls.cpp ode-0.16.2/ode/src/odetls.cpp --- ode-0.16/ode/src/odetls.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/odetls.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -1,7 +1,7 @@ /************************************************************************* * * * Thread local storage access stub for Open Dynamics Engine, * - * Copyright (C) 2008 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2008-2019 Oleh Derevenko. All rights reserved. * * Email: odar@eleks.com (change all "a" to "e") * * * * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * diff -Nru ode-0.16/ode/src/odetls.h ode-0.16.2/ode/src/odetls.h --- ode-0.16/ode/src/odetls.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/odetls.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,7 +1,7 @@ /************************************************************************* * * * Thread local storage access stub for Open Dynamics Engine, * - * Copyright (C) 2008 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2008-2019 Oleh Derevenko. All rights reserved. * * Email: odar@eleks.com (change all "a" to "e") * * * * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * diff -Nru ode-0.16/ode/src/resource_control.cpp ode-0.16.2/ode/src/resource_control.cpp --- ode-0.16/ode/src/resource_control.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/resource_control.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -22,7 +22,7 @@ /* * Resource accounting/preallocation class implementations - * Copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ diff -Nru ode-0.16/ode/src/resource_control.h ode-0.16.2/ode/src/resource_control.h --- ode-0.16/ode/src/resource_control.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/resource_control.h 2020-07-30 13:27:35.000000000 +0000 @@ -22,7 +22,7 @@ /* * Resource accounting/preallocation class declarations - * Copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ #ifndef _ODE__PRIVATE_RESOURCE_CONTRIOL_H_ diff -Nru ode-0.16/ode/src/simple_cooperative.cpp ode-0.16.2/ode/src/simple_cooperative.cpp --- ode-0.16/ode/src/simple_cooperative.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/simple_cooperative.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading base wrapper class header file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * @@ -26,7 +26,7 @@ /* * The simple cooperative class implementation - * Copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ diff -Nru ode-0.16/ode/src/simple_cooperative.h ode-0.16.2/ode/src/simple_cooperative.h --- ode-0.16/ode/src/simple_cooperative.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/simple_cooperative.h 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading base wrapper class header file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * @@ -26,7 +26,7 @@ /* * A simple cooperative class definition - * Copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ diff -Nru ode-0.16/ode/src/threaded_solver_ldlt.h ode-0.16.2/ode/src/threaded_solver_ldlt.h --- ode-0.16/ode/src/threaded_solver_ldlt.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/threaded_solver_ldlt.h 2020-07-30 13:27:35.000000000 +0000 @@ -22,7 +22,7 @@ /* * Equation System Threaded Solver - * Copyright (c) 2017 Oleh Derevenko, odar@eleks.com (change all "a" to "e") + * Copyright (c) 2017-2019 Oleh Derevenko, odar@eleks.com (change all "a" to "e") */ diff -Nru ode-0.16/ode/src/threading_atomics_provs.h ode-0.16.2/ode/src/threading_atomics_provs.h --- ode-0.16/ode/src/threading_atomics_provs.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/threading_atomics_provs.h 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading atomics providers file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ode/src/threading_base.cpp ode-0.16.2/ode/src/threading_base.cpp --- ode-0.16/ode/src/threading_base.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/threading_base.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading base wrapper class implementation file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ode/src/threading_base.h ode-0.16.2/ode/src/threading_base.h --- ode-0.16/ode/src/threading_base.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/threading_base.h 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading base wrapper class header file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ode/src/threading_fake_sync.h ode-0.16.2/ode/src/threading_fake_sync.h --- ode-0.16/ode/src/threading_fake_sync.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/threading_fake_sync.h 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading fake synchronization objects file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ode/src/threading_impl.cpp ode-0.16.2/ode/src/threading_impl.cpp --- ode-0.16/ode/src/threading_impl.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/threading_impl.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading subsystem implementation file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ode/src/threading_impl.h ode-0.16.2/ode/src/threading_impl.h --- ode-0.16/ode/src/threading_impl.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/threading_impl.h 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading implementation private header file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ode/src/threading_impl_posix.h ode-0.16.2/ode/src/threading_impl_posix.h --- ode-0.16/ode/src/threading_impl_posix.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/threading_impl_posix.h 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading POSIX implementation file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * @@ -55,17 +55,6 @@ #endif -#if HAVE_PTHREAD_CONDATTR_SETCLOCK - -static inline -int _condvar_clock_gettime(int clock_type, timespec *ts) -{ - return clock_gettime(clock_type, ts); -} - - -#else // #if !HAVE_PTHREAD_CONDATTR_SETCLOCK - #if defined(__APPLE__) #if HAVE_GETTIMEOFDAY @@ -95,16 +84,36 @@ #else // #if !defined(__APPLE__) +#if !HAVE_PTHREAD_CONDATTR_SETCLOCK && !HAVE_NO_PTHREAD_CONDATTR_SETCLOCK -#error It is necessary to check manuals for the correct way of getting condvar wait time for this system +// The code must be compiled without autoconf run, having the project generated by other means. +// Assume the pthread_condattr_setclock() is available as it is true in most cases and it is the best we can do in such cases. +#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1 -#endif // #if !defined(__APPLE__) +#endif // #if !HAVE_PTHREAD_CONDATTR_SETCLOCK && !HAVE_NO_PTHREAD_CONDATTR_SETCLOCK + + +#if HAVE_PTHREAD_CONDATTR_SETCLOCK + +static inline +int _condvar_clock_gettime(int clock_type, timespec *ts) +{ + return clock_gettime(clock_type, ts); +} + + +#else // #if !HAVE_PTHREAD_CONDATTR_SETCLOCK + +#error It is necessary to check manuals for the correct way of getting condvar wait time for this system #endif // #if !HAVE_PTHREAD_CONDATTR_SETCLOCK +#endif // #if !defined(__APPLE__) + + /************************************************************************/ /* dxCondvarWakeup class implementation */ /************************************************************************/ diff -Nru ode-0.16/ode/src/threading_impl_templates.h ode-0.16.2/ode/src/threading_impl_templates.h --- ode-0.16/ode/src/threading_impl_templates.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/threading_impl_templates.h 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading implementation templates file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * @@ -660,19 +660,24 @@ break; } - void *job_call_wait = current_job->m_call_wait; - - if (job_call_wait != NULL) - { - wait_signal_proc_ptr(job_call_wait); - } - int call_fault = current_job->m_call_fault; + // Assign the accumulated fault state first... if (current_job->m_fault_accumulator_ptr) { *current_job->m_fault_accumulator_ptr = call_fault; } + + // ...and only then release the entity waiting on the job. + // The entity can be waiting for the fault state + // and may start accessing it and/or dispose the storage + // immediately after having been awakened. + void *job_call_wait = current_job->m_call_wait; + + if (job_call_wait != NULL) + { + wait_signal_proc_ptr(job_call_wait); + } dxThreadedJobInfo *dependent_job = current_job->m_dependent_job; ReleaseJobInfoIntoPool(current_job); diff -Nru ode-0.16/ode/src/threading_impl_win.h ode-0.16.2/ode/src/threading_impl_win.h --- ode-0.16/ode/src/threading_impl_win.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/threading_impl_win.h 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading Windows implementation file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ode/src/threading_pool_posix.cpp ode-0.16.2/ode/src/threading_pool_posix.cpp --- ode-0.16/ode/src/threading_pool_posix.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/threading_pool_posix.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading POSIX thread pool implementation file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * @@ -371,7 +371,9 @@ int set_result; if ((set_result = pthread_attr_setdetachstate(thread_attr, PTHREAD_CREATE_JOINABLE)) != EOK +#if (HAVE_PTHREAD_ATTR_SETINHERITSCHED) || (set_result = pthread_attr_setinheritsched(thread_attr, PTHREAD_INHERIT_SCHED)) != EOK +#endif #if (HAVE_PTHREAD_ATTR_SETSTACKLAZY) || (set_result = pthread_attr_setstacklazy(thread_attr, PTHREAD_STACK_NOTLAZY)) != EOK #endif diff -Nru ode-0.16/ode/src/threading_pool_win.cpp ode-0.16.2/ode/src/threading_pool_win.cpp --- ode-0.16/ode/src/threading_pool_win.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ode/src/threading_pool_win.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -4,7 +4,7 @@ * All rights reserved. Email: russ@q12.org Web: www.q12.org * * * * Threading Windows thread pool implementation file. * - * Copyright (C) 2011-2012 Oleh Derevenko. All rights reserved. * + * Copyright (C) 2011-2019 Oleh Derevenko. All rights reserved. * * e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/assert.h ode-0.16.2/ou/include/ou/assert.h --- ode-0.16/ou/include/ou/assert.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/assert.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/atomicflags.h ode-0.16.2/ou/include/ou/atomicflags.h --- ode-0.16/ou/include/ou/atomicflags.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/atomicflags.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/atomic.h ode-0.16.2/ou/include/ou/atomic.h --- ode-0.16/ou/include/ou/atomic.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/atomic.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * @@ -1630,7 +1630,7 @@ BEGIN_NAMESPACE_OU(); -typedef int32_t atomicord32; +typedef uint32_t atomicord32; typedef void *atomicptr; diff -Nru ode-0.16/ou/include/ou/customization.h ode-0.16.2/ou/include/ou/customization.h --- ode-0.16/ou/include/ou/customization.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/customization.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/enumarrays.h ode-0.16.2/ou/include/ou/enumarrays.h --- ode-0.16/ou/include/ou/enumarrays.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/enumarrays.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/features.h ode-0.16.2/ou/include/ou/features.h --- ode-0.16/ou/include/ou/features.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/features.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/flagsdefines.h ode-0.16.2/ou/include/ou/flagsdefines.h --- ode-0.16/ou/include/ou/flagsdefines.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/flagsdefines.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/flags.h ode-0.16.2/ou/include/ou/flags.h --- ode-0.16/ou/include/ou/flags.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/flags.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/inttypes.h ode-0.16.2/ou/include/ou/inttypes.h --- ode-0.16/ou/include/ou/inttypes.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/inttypes.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/macros.h ode-0.16.2/ou/include/ou/macros.h --- ode-0.16/ou/include/ou/macros.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/macros.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/malloc.h ode-0.16.2/ou/include/ou/malloc.h --- ode-0.16/ou/include/ou/malloc.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/malloc.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/namespace.h ode-0.16.2/ou/include/ou/namespace.h --- ode-0.16/ou/include/ou/namespace.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/namespace.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/platform.h ode-0.16.2/ou/include/ou/platform.h --- ode-0.16/ou/include/ou/platform.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/platform.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,398 +1,398 @@ -/************************************************************************* - * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * - * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of EITHER: * - * (1) The GNU Lesser General Public License as published by the Free * - * Software Foundation; either version 3 of the License, or (at * - * your option) any later version. The text of the GNU Lesser * - * General Public License is included with this library in the * - * file LICENSE-LESSER.TXT. Since LGPL is the extension of GPL * - * the text of GNU General Public License is also provided for * - * your information in file LICENSE.TXT. * - * (2) The BSD-style license that is included with this library in * - * the file LICENSE-BSD.TXT. * - * (3) The zlib/libpng license that is included with this library in * - * the file LICENSE-ZLIB.TXT * - * * - * This library is distributed WITHOUT ANY WARRANTY, including implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the files LICENSE.TXT and LICENSE-LESSER.TXT or LICENSE-BSD.TXT * - * or LICENSE-ZLIB.TXT for more details. * - * * - *************************************************************************/ - -#ifndef __OU_PLATFORM_H_INCLUDED -#define __OU_PLATFORM_H_INCLUDED - - -////////////////////////////////////////////////////////////////////////// -// Target definitions - -#define _OU_TARGET_OS_GENUNIX 1 -#define _OU_TARGET_OS_WINDOWS 2 -#define _OU_TARGET_OS_QNX 3 -#define _OU_TARGET_OS_MAC 4 -#define _OU_TARGET_OS_AIX 5 -#define _OU_TARGET_OS_SUNOS 6 -#define _OU_TARGET_OS_IOS 7 - -#define _OU_TARGET_OS__MAX 8 - - -#define _OU_TARGET_BITS_32 1 -#define _OU_TARGET_BITS_64 2 - -#define _OU_TARGET_BITS__MAX 3 - - -#define _OU_TARGET_ARCH_OTHER 1 -#define _OU_TARGET_ARCH_X86 2 -#define _OU_TARGET_ARCH_IA64 3 -#define _OU_TARGET_ARCH_X64 4 -#define _OU_TARGET_ARCH_POWERPC 5 -#define _OU_TARGET_ARCH_SPARC 6 -#define _OU_TARGET_ARCH_ARM 7 -#define _OU_TARGET_ARCH_AARCH64 8 - -#define _OU_TARGET_ARCH__MAX 9 - - -////////////////////////////////////////////////////////////////////////// - -#if !defined(_OU_TARGET_OS) - - -#if defined(_WINDOWS) || defined(_WIN32) - -#define _OU_TARGET_OS _OU_TARGET_OS_WINDOWS - - -#elif defined(__QNX__) - -#define _OU_TARGET_OS _OU_TARGET_OS_QNX - - -#elif defined(__APPLE__) - -#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR - -#define _OU_TARGET_OS _OU_TARGET_OS_IOS - -#if !defined(MAC_OS_X_VERSION) -#define MAC_OS_X_VERSION 1050 -#endif - - +/************************************************************************* + * * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * + * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of EITHER: * + * (1) The GNU Lesser General Public License as published by the Free * + * Software Foundation; either version 3 of the License, or (at * + * your option) any later version. The text of the GNU Lesser * + * General Public License is included with this library in the * + * file LICENSE-LESSER.TXT. Since LGPL is the extension of GPL * + * the text of GNU General Public License is also provided for * + * your information in file LICENSE.TXT. * + * (2) The BSD-style license that is included with this library in * + * the file LICENSE-BSD.TXT. * + * (3) The zlib/libpng license that is included with this library in * + * the file LICENSE-ZLIB.TXT * + * * + * This library is distributed WITHOUT ANY WARRANTY, including implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the files LICENSE.TXT and LICENSE-LESSER.TXT or LICENSE-BSD.TXT * + * or LICENSE-ZLIB.TXT for more details. * + * * + *************************************************************************/ + +#ifndef __OU_PLATFORM_H_INCLUDED +#define __OU_PLATFORM_H_INCLUDED + + +////////////////////////////////////////////////////////////////////////// +// Target definitions + +#define _OU_TARGET_OS_GENUNIX 1 +#define _OU_TARGET_OS_WINDOWS 2 +#define _OU_TARGET_OS_QNX 3 +#define _OU_TARGET_OS_MAC 4 +#define _OU_TARGET_OS_AIX 5 +#define _OU_TARGET_OS_SUNOS 6 +#define _OU_TARGET_OS_IOS 7 + +#define _OU_TARGET_OS__MAX 8 + + +#define _OU_TARGET_BITS_32 1 +#define _OU_TARGET_BITS_64 2 + +#define _OU_TARGET_BITS__MAX 3 + + +#define _OU_TARGET_ARCH_OTHER 1 +#define _OU_TARGET_ARCH_X86 2 +#define _OU_TARGET_ARCH_IA64 3 +#define _OU_TARGET_ARCH_X64 4 +#define _OU_TARGET_ARCH_POWERPC 5 +#define _OU_TARGET_ARCH_SPARC 6 +#define _OU_TARGET_ARCH_ARM 7 +#define _OU_TARGET_ARCH_AARCH64 8 + +#define _OU_TARGET_ARCH__MAX 9 + + +////////////////////////////////////////////////////////////////////////// + +#if !defined(_OU_TARGET_OS) + + +#if defined(_WINDOWS) || defined(_WIN32) + +#define _OU_TARGET_OS _OU_TARGET_OS_WINDOWS + + +#elif defined(__QNX__) + +#define _OU_TARGET_OS _OU_TARGET_OS_QNX + + +#elif defined(__APPLE__) + +#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR + +#define _OU_TARGET_OS _OU_TARGET_OS_IOS + +#if !defined(MAC_OS_X_VERSION) +#define MAC_OS_X_VERSION 1050 +#endif + + #elif TARGET_OS_MAC - -#define _OU_TARGET_OS _OU_TARGET_OS_MAC - - -#else // An unknown Apple target - -#error Build Apple target is not supported - - -#endif // // An unknown Apple target - -#elif defined(__aix__) - -#define _OU_TARGET_OS _OU_TARGET_OS_AIX - - -#elif defined(__sun__) - -#define _OU_TARGET_OS _OU_TARGET_OS_SUNOS - - -#elif defined(__unix__) - -#define _OU_TARGET_OS _OU_TARGET_OS_GENUNIX - - -#else // if no known define found - -#error Build target is not supported - - -#endif // Target OS definitions - - -#else // #if defined(_OU_TARGET_OS) - -#if _OU_TARGET_OS <= 0 || _OU_TARGET_OS >= _OU_TARGET_OS__MAX - -#error Please define a valid value for _OU_TARGET_OS - - -#endif // #if _OU_TARGET_OS <= 0 || _OU_TARGET_OS >= _OU_TARGET_OS__MAX - - -#endif // #if defined(_OU_TARGET_OS) - - -#if _OU_TARGET_OS == _OU_TARGET_OS_MAC - -#if !defined(MAC_OS_X_VERSION) - -#error Please defile preprocessor symbol MAC_OS_X_VERSION in command line (e.g. "-DMAC_OS_X_VERSION=1050" for MacOS 10.5) - - -#endif // #if !defined(MAC_OS_X_VERSION) - - -#endif // #if _OU_TARGET_OS == _OU_TARGET_OS_MAC - - -////////////////////////////////////////////////////////////////////////// - -#if !defined(_OU_TARGET_BITS) - - -#if defined(_LP64) || defined(_WIN64) - -#define _OU_TARGET_BITS _OU_TARGET_BITS_64 - - -#else // #if !defined(_LP64) - -#define _OU_TARGET_BITS _OU_TARGET_BITS_32 - - -#endif // #if !defined(_LP64) - - -#else // #if defined(_OU_TARGET_BITS) - -#if _OU_TARGET_BITS <= 0 || _OU_TARGET_BITS >= _OU_TARGET_BITS__MAX - -#error Please define a valid value for _OU_TARGET_BITS - - -#endif // #if _OU_TARGET_BITS <= 0 || _OU_TARGET_BITS >= _OU_TARGET_BITS__MAX - - -#endif // #if defined(_OU_TARGET_BITS) - - -////////////////////////////////////////////////////////////////////////// - -#if !defined(_OU_TARGET_ARCH) - - -#if defined(__i386__) || defined(_M_IX86) - -#define _OU_TARGET_ARCH _OU_TARGET_ARCH_X86 - - -#elif defined(__ia64__) || defined(_M_IA64) - -#define _OU_TARGET_ARCH _OU_TARGET_ARCH_IA64 - - -#elif defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) - -#define _OU_TARGET_ARCH _OU_TARGET_ARCH_X64 - - -#elif defined(__ppc__) - -#define _OU_TARGET_ARCH _OU_TARGET_ARCH_POWERPC - - -#elif defined(__sparc__) - -#define _OU_TARGET_ARCH _OU_TARGET_ARCH_SPARC - - -#elif defined(__arm__) || defined(_M_ARM) || defined(TARGET_OS_IPHONE) - -#define _OU_TARGET_ARCH _OU_TARGET_ARCH_ARM - - -#elif defined(__aarch64__) - -#define _OU_TARGET_ARCH _OU_TARGET_ARCH_AARCH64 - - -#else // Unknown architecture - -#define _OU_TARGET_ARCH _OU_TARGET_ARCH_OTHER - - -#endif // Architecture definitions - - -#else // #if defined(_OU_TARGET_ARCH) - -#if _OU_TARGET_ARCH <= 0 || _OU_TARGET_ARCH >= _OU_TARGET_ARCH__MAX - -#error Please define a valid value for _OU_TARGET_ARCH - - -#endif // #if _OU_TARGET_ARCH <= 0 || _OU_TARGET_ARCH >= _OU_TARGET_ARCH__MAX - - -#endif // #if defined(_OU_TARGET_ARCH) - - -////////////////////////////////////////////////////////////////////////// -// Compiler definition - -#define _OU_COMPILER__OTHER 1 -#define _OU_COMPILER_GCC 2 -#define _OU_COMPILER_MSVC 3 - -#define _OU_COMPILER__MAX 4 - - -#define _OU_COMPILER_VERSION__OTHER 1 -#define _OU_COMPILER_VERSION_MSVC1998 2 -#define _OU_COMPILER_VERSION_GCCLT4 3 - -#define _OU_COMPILER_VERSION__MAX 4 - - -////////////////////////////////////////////////////////////////////////// - -#if !defined(_OU_COMPILER) - -#if defined(__GNUC__) - -#define _OU_COMPILER _OU_COMPILER_GCC - -#if __GNUC__ < 4 - -#define _OU_COMPILER_VERSION _OU_COMPILER_VERSION_GCCLT4 - - -#endif // compiler version - - -#elif defined(_MSC_VER) - -#define _OU_COMPILER _OU_COMPILER_MSVC - -#if _MSC_VER <= 1200 - -#define _OU_COMPILER_VERSION _OU_COMPILER_VERSION_MSVC1998 - - -#endif // compiler version - - -#else // if no known define found - -#define _OU_COMPILER _OU_COMPILER__OTHER - - -#endif // Compiler specific definitions - - -#else // #if defined(_OU_COMPILER) - -#if _OU_COMPILER <= 0 || _OU_COMPILER >= _OU_COMPILER__MAX - -#error Please define a valid value for _OU_COMPILER - - -#endif // #if _OU_COMPILER <= 0 || _OU_COMPILER >= _OU_COMPILER__MAX - - -#endif // #if defined(_OU_COMPILER) - - -#if !defined(_OU_COMPILER_VERSION) - -#define _OU_COMPILER_VERSION _OU_COMPILER_VERSION__OTHER - - -#endif // #if !defined(_OU_COMPILER_VERSION) - - -#if _OU_COMPILER_VERSION <= 0 || _OU_COMPILER_VERSION >= _OU_COMPILER_VERSION__MAX - -#error Please define a valid value for _OU_COMPILER_VERSION - - -#endif // #if _OU_COMPILER_VERSION <= 0 || _OU_COMPILER_VERSION >= _OU_COMPILER_VERSION__MAX - - -////////////////////////////////////////////////////////////////////////// -// Calling convention definition - -#if !defined(__OU_CONVENTIONS_DEFINED) - -#define __OU_CONVENTIONS_DEFINED - - -#if _OU_TARGET_OS == _OU_TARGET_OS_WINDOWS - -#define _OU_CONVENTION_METHOD -#define _OU_CONVENTION_API __stdcall -#define _OU_CONVENTION_CALLBACK __stdcall - - -#else // #if _OU_TARGET_OS != _OU_TARGET_OS_WINDOWS - -#define _OU_CONVENTION_METHOD -#define _OU_CONVENTION_API -#define _OU_CONVENTION_CALLBACK - - -#endif // #if _OU_TARGET_OS == ... - - -#endif // #if !defined(__OU_CONVENTIONS_DEFINED) - - -////////////////////////////////////////////////////////////////////////// -// _OU_ALWAYSINLINE/_OU_INLINE definition - -#if !defined(__OU_INLINES_DEFINED) - -#define __OU_INLINES_DEFINED - - -#if _OU_COMPILER == _OU_COMPILER_GCC - -#define _OU_ALWAYSINLINE__DEFINITION inline __attribute__((always_inline)) - - -#elif _OU_COMPILER == _OU_COMPILER_MSVC - -#define _OU_ALWAYSINLINE__DEFINITION inline __forceinline - - -#else // if _OU_COMPILER == _OU_COMPILER_OTHER - -#define _OU_ALWAYSINLINE__DEFINITION inline - - -#endif // #if _OU_COMPILER == ... - - -#if defined(_DEBUG) - -#define _OU_ALWAYSINLINE inline - -#define _OU_INLINE inline - - -#else // #if !defined(_DEBUG) - -#define _OU_ALWAYSINLINE _OU_ALWAYSINLINE__DEFINITION - -#define _OU_INLINE inline - - -#endif // #if !defined(_DEBUG) - - -#endif // #if !defined(__OU_INLINES_DEFINED) - - -#endif // #ifndef __OU_PLATFORM_H_INCLUDED + +#define _OU_TARGET_OS _OU_TARGET_OS_MAC + + +#else // An unknown Apple target + +#error Build Apple target is not supported + + +#endif // // An unknown Apple target + +#elif defined(__aix__) + +#define _OU_TARGET_OS _OU_TARGET_OS_AIX + + +#elif defined(__sun__) + +#define _OU_TARGET_OS _OU_TARGET_OS_SUNOS + + +#elif defined(__unix__) + +#define _OU_TARGET_OS _OU_TARGET_OS_GENUNIX + + +#else // if no known define found + +#error Build target is not supported + + +#endif // Target OS definitions + + +#else // #if defined(_OU_TARGET_OS) + +#if _OU_TARGET_OS <= 0 || _OU_TARGET_OS >= _OU_TARGET_OS__MAX + +#error Please define a valid value for _OU_TARGET_OS + + +#endif // #if _OU_TARGET_OS <= 0 || _OU_TARGET_OS >= _OU_TARGET_OS__MAX + + +#endif // #if defined(_OU_TARGET_OS) + + +#if _OU_TARGET_OS == _OU_TARGET_OS_MAC + +#if !defined(MAC_OS_X_VERSION) + +#error Please defile preprocessor symbol MAC_OS_X_VERSION in command line (e.g. "-DMAC_OS_X_VERSION=1050" for MacOS 10.5) + + +#endif // #if !defined(MAC_OS_X_VERSION) + + +#endif // #if _OU_TARGET_OS == _OU_TARGET_OS_MAC + + +////////////////////////////////////////////////////////////////////////// + +#if !defined(_OU_TARGET_BITS) + + +#if defined(_LP64) || defined(_WIN64) + +#define _OU_TARGET_BITS _OU_TARGET_BITS_64 + + +#else // #if !defined(_LP64) + +#define _OU_TARGET_BITS _OU_TARGET_BITS_32 + + +#endif // #if !defined(_LP64) + + +#else // #if defined(_OU_TARGET_BITS) + +#if _OU_TARGET_BITS <= 0 || _OU_TARGET_BITS >= _OU_TARGET_BITS__MAX + +#error Please define a valid value for _OU_TARGET_BITS + + +#endif // #if _OU_TARGET_BITS <= 0 || _OU_TARGET_BITS >= _OU_TARGET_BITS__MAX + + +#endif // #if defined(_OU_TARGET_BITS) + + +////////////////////////////////////////////////////////////////////////// + +#if !defined(_OU_TARGET_ARCH) + + +#if defined(__i386__) || defined(_M_IX86) + +#define _OU_TARGET_ARCH _OU_TARGET_ARCH_X86 + + +#elif defined(__ia64__) || defined(_M_IA64) + +#define _OU_TARGET_ARCH _OU_TARGET_ARCH_IA64 + + +#elif defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) + +#define _OU_TARGET_ARCH _OU_TARGET_ARCH_X64 + + +#elif defined(__ppc__) + +#define _OU_TARGET_ARCH _OU_TARGET_ARCH_POWERPC + + +#elif defined(__sparc__) + +#define _OU_TARGET_ARCH _OU_TARGET_ARCH_SPARC + + +#elif defined(__arm__) || defined(_M_ARM) || defined(TARGET_OS_IPHONE) + +#define _OU_TARGET_ARCH _OU_TARGET_ARCH_ARM + + +#elif defined(__aarch64__) + +#define _OU_TARGET_ARCH _OU_TARGET_ARCH_AARCH64 + + +#else // Unknown architecture + +#define _OU_TARGET_ARCH _OU_TARGET_ARCH_OTHER + + +#endif // Architecture definitions + + +#else // #if defined(_OU_TARGET_ARCH) + +#if _OU_TARGET_ARCH <= 0 || _OU_TARGET_ARCH >= _OU_TARGET_ARCH__MAX + +#error Please define a valid value for _OU_TARGET_ARCH + + +#endif // #if _OU_TARGET_ARCH <= 0 || _OU_TARGET_ARCH >= _OU_TARGET_ARCH__MAX + + +#endif // #if defined(_OU_TARGET_ARCH) + + +////////////////////////////////////////////////////////////////////////// +// Compiler definition + +#define _OU_COMPILER__OTHER 1 +#define _OU_COMPILER_GCC 2 +#define _OU_COMPILER_MSVC 3 + +#define _OU_COMPILER__MAX 4 + + +#define _OU_COMPILER_VERSION__OTHER 1 +#define _OU_COMPILER_VERSION_MSVC1998 2 +#define _OU_COMPILER_VERSION_GCCLT4 3 + +#define _OU_COMPILER_VERSION__MAX 4 + + +////////////////////////////////////////////////////////////////////////// + +#if !defined(_OU_COMPILER) + +#if defined(__GNUC__) + +#define _OU_COMPILER _OU_COMPILER_GCC + +#if __GNUC__ < 4 + +#define _OU_COMPILER_VERSION _OU_COMPILER_VERSION_GCCLT4 + + +#endif // compiler version + + +#elif defined(_MSC_VER) + +#define _OU_COMPILER _OU_COMPILER_MSVC + +#if _MSC_VER <= 1200 + +#define _OU_COMPILER_VERSION _OU_COMPILER_VERSION_MSVC1998 + + +#endif // compiler version + + +#else // if no known define found + +#define _OU_COMPILER _OU_COMPILER__OTHER + + +#endif // Compiler specific definitions + + +#else // #if defined(_OU_COMPILER) + +#if _OU_COMPILER <= 0 || _OU_COMPILER >= _OU_COMPILER__MAX + +#error Please define a valid value for _OU_COMPILER + + +#endif // #if _OU_COMPILER <= 0 || _OU_COMPILER >= _OU_COMPILER__MAX + + +#endif // #if defined(_OU_COMPILER) + + +#if !defined(_OU_COMPILER_VERSION) + +#define _OU_COMPILER_VERSION _OU_COMPILER_VERSION__OTHER + + +#endif // #if !defined(_OU_COMPILER_VERSION) + + +#if _OU_COMPILER_VERSION <= 0 || _OU_COMPILER_VERSION >= _OU_COMPILER_VERSION__MAX + +#error Please define a valid value for _OU_COMPILER_VERSION + + +#endif // #if _OU_COMPILER_VERSION <= 0 || _OU_COMPILER_VERSION >= _OU_COMPILER_VERSION__MAX + + +////////////////////////////////////////////////////////////////////////// +// Calling convention definition + +#if !defined(__OU_CONVENTIONS_DEFINED) + +#define __OU_CONVENTIONS_DEFINED + + +#if _OU_TARGET_OS == _OU_TARGET_OS_WINDOWS + +#define _OU_CONVENTION_METHOD +#define _OU_CONVENTION_API __stdcall +#define _OU_CONVENTION_CALLBACK __stdcall + + +#else // #if _OU_TARGET_OS != _OU_TARGET_OS_WINDOWS + +#define _OU_CONVENTION_METHOD +#define _OU_CONVENTION_API +#define _OU_CONVENTION_CALLBACK + + +#endif // #if _OU_TARGET_OS == ... + + +#endif // #if !defined(__OU_CONVENTIONS_DEFINED) + + +////////////////////////////////////////////////////////////////////////// +// _OU_ALWAYSINLINE/_OU_INLINE definition + +#if !defined(__OU_INLINES_DEFINED) + +#define __OU_INLINES_DEFINED + + +#if _OU_COMPILER == _OU_COMPILER_GCC + +#define _OU_ALWAYSINLINE__DEFINITION inline __attribute__((always_inline)) + + +#elif _OU_COMPILER == _OU_COMPILER_MSVC + +#define _OU_ALWAYSINLINE__DEFINITION inline __forceinline + + +#else // if _OU_COMPILER == _OU_COMPILER_OTHER + +#define _OU_ALWAYSINLINE__DEFINITION inline + + +#endif // #if _OU_COMPILER == ... + + +#if defined(_DEBUG) + +#define _OU_ALWAYSINLINE inline + +#define _OU_INLINE inline + + +#else // #if !defined(_DEBUG) + +#define _OU_ALWAYSINLINE _OU_ALWAYSINLINE__DEFINITION + +#define _OU_INLINE inline + + +#endif // #if !defined(_DEBUG) + + +#endif // #if !defined(__OU_INLINES_DEFINED) + + +#endif // #ifndef __OU_PLATFORM_H_INCLUDED diff -Nru ode-0.16/ou/include/ou/simpleflags.h ode-0.16.2/ou/include/ou/simpleflags.h --- ode-0.16/ou/include/ou/simpleflags.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/simpleflags.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/templates.h ode-0.16.2/ou/include/ou/templates.h --- ode-0.16/ou/include/ou/templates.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/templates.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/include/ou/threadlocalstorage.h ode-0.16.2/ou/include/ou/threadlocalstorage.h --- ode-0.16/ou/include/ou/threadlocalstorage.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/threadlocalstorage.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,297 +1,297 @@ -/************************************************************************* - * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * - * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of EITHER: * - * (1) The GNU Lesser General Public License as published by the Free * - * Software Foundation; either version 3 of the License, or (at * - * your option) any later version. The text of the GNU Lesser * - * General Public License is included with this library in the * - * file LICENSE-LESSER.TXT. Since LGPL is the extension of GPL * - * the text of GNU General Public License is also provided for * - * your information in file LICENSE.TXT. * - * (2) The BSD-style license that is included with this library in * - * the file LICENSE-BSD.TXT. * - * (3) The zlib/libpng license that is included with this library in * - * the file LICENSE-ZLIB.TXT * - * * - * This library is distributed WITHOUT ANY WARRANTY, including implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the files LICENSE.TXT and LICENSE-LESSER.TXT or LICENSE-BSD.TXT * - * or LICENSE-ZLIB.TXT for more details. * - * * - *************************************************************************/ - -#ifndef _OU_THREADLOCALSTORAGE_H_INCLUDED -#define _OU_THREADLOCALSTORAGE_H_INCLUDED - - +/************************************************************************* + * * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * + * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of EITHER: * + * (1) The GNU Lesser General Public License as published by the Free * + * Software Foundation; either version 3 of the License, or (at * + * your option) any later version. The text of the GNU Lesser * + * General Public License is included with this library in the * + * file LICENSE-LESSER.TXT. Since LGPL is the extension of GPL * + * the text of GNU General Public License is also provided for * + * your information in file LICENSE.TXT. * + * (2) The BSD-style license that is included with this library in * + * the file LICENSE-BSD.TXT. * + * (3) The zlib/libpng license that is included with this library in * + * the file LICENSE-ZLIB.TXT * + * * + * This library is distributed WITHOUT ANY WARRANTY, including implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the files LICENSE.TXT and LICENSE-LESSER.TXT or LICENSE-BSD.TXT * + * or LICENSE-ZLIB.TXT for more details. * + * * + *************************************************************************/ + +#ifndef _OU_THREADLOCALSTORAGE_H_INCLUDED +#define _OU_THREADLOCALSTORAGE_H_INCLUDED + + #include #if _OU_FEATURE_SET >= _OU_FEATURE_SET_TLS -#include -#include -#include -#include -#include - -#if _OU_TARGET_OS == _OU_TARGET_OS_WINDOWS - -#include - - -#else // #if _OU_TARGET_OS != _OU_TARGET_OS_WINDOWS - -#include - - -#endif // #if _OU_TARGET_OS == ... - - -BEGIN_NAMESPACE_OU(); - - -////////////////////////////////////////////////////////////////////////// -// API specific types - -typedef CTypeSimpleWrapper HTLSKEYVALUE; -typedef CTypeSimpleWrapper HTLSKEYSELECTOR; -typedef HTLSKEYSELECTOR HTLSKEY; - -typedef void *tlsvaluetype; -typedef unsigned int tlsindextype; - -typedef void (_OU_CONVENTION_CALLBACK *CTLSValueDestructor)(tlsvaluetype vValueData); - - -#define OU_TLS_VALUE_AS_POINTER(value) (value) - - -////////////////////////////////////////////////////////////////////////// -// Internal types required for functions to be made inline - -struct CTLSStorageArray; - -struct CTLSStorageBlock -{ -/* - * Implementation Note: - * 1) Value destructors are stored in separate array since those are - * rarely accessed values and not intermixing them with data - * potentially simplifies data access (well, just theoretically, of course :)). - * 2) Destructors are stored with negative offset to allow accessing them - * without the knowledge of value count. - * 3) Well, intermixing or not intermixing has really minor impact on - * implementation characteristics, so why not to choose it after the current mood? :) - */ -private: - enum - { - TSB_RESERVEDPOINTER_HOSTARRAY, - - TSB_RESERVEDPOINTER__MAX, - }; - -public: - enum - { - TSB_LARGEST_ALIGNMENT = sizeof(void *) > sizeof(tlsvaluetype) ? sizeof(void *) : sizeof(tlsvaluetype), - }; - -public: - static inline size_t GetRequiredSize(tlsindextype iValueCount) - { - return OU_ALIGNED_SIZE(iValueCount * (sizeof(tlsvaluetype) + sizeof(CTLSValueDestructor)) + TSB_RESERVEDPOINTER__MAX * sizeof(void *), TSB_LARGEST_ALIGNMENT); - } - - static inline size_t GetZeroOffset(tlsindextype iValueCount) - { - // Since pointers and values are stored in different directions, - // alignment correction must fall entirely to either side and - // required size will not be exceeded. - return OU_ALIGNED_SIZE(iValueCount * sizeof(CTLSValueDestructor) + TSB_RESERVEDPOINTER__MAX * sizeof(void *), TSB_LARGEST_ALIGNMENT); - } - -public: - inline void SetValueData(tlsindextype iValueIndex, tlsvaluetype vValueData) - { - un.m_av_ValueDatas[iValueIndex] = vValueData; - } - - inline tlsvaluetype GetValueData(tlsindextype iValueIndex) const - { - return un.m_av_ValueDatas[iValueIndex]; - } - - inline void SetHostArray(CTLSStorageArray *psaInstance) - { - un.m_asaHostArrays[(ptrdiff_t)0 - (1 + TSB_RESERVEDPOINTER_HOSTARRAY)] = psaInstance; - } - - inline CTLSStorageArray *GetHostArray() const - { - return un.m_asaHostArrays[(ptrdiff_t)0 - (1 + TSB_RESERVEDPOINTER_HOSTARRAY)]; - } - - inline void SetValueDestructor(tlsindextype iValueIndex, CTLSValueDestructor fvValue) - { - un.m_afnValueDestructors[-((ptrdiff_t)iValueIndex) - (1 + TSB_RESERVEDPOINTER__MAX)] = fvValue; - } - - inline CTLSValueDestructor GetValueDestructor(tlsindextype iValueIndex) const - { - return un.m_afnValueDestructors[-((ptrdiff_t)iValueIndex) - (1 + TSB_RESERVEDPOINTER__MAX)]; - } - -private: - union - { - tlsvaluetype m_av_ValueDatas[1]; - CTLSValueDestructor m_afnValueDestructors[1]; - CTLSStorageArray *m_asaHostArrays[1]; - } un; -}; - - -////////////////////////////////////////////////////////////////////////// -// API declaration - -class CThreadLocalStorage -{ -public: // Safe methods - /* - * Implementation Note: - * Since the function is potentially slow and should not be frequently - * called anyway, there is no sense in creating additional overload without - * destructor parameter which would preserve current destructor procedure. - */ - static _OU_ALWAYSINLINE bool _OU_CONVENTION_API - /*bool */SetStorageValue(const HTLSKEY &hskStorageKey, tlsindextype iValueIndex, tlsvaluetype vValueData, CTLSValueDestructor fnValueDestructor=NULL) - { - bool bResult; - - CTLSStorageBlock *psbStorageBlock = GetKeyStorageBlock(hskStorageKey); - - if (psbStorageBlock) - { - psbStorageBlock->SetValueData(iValueIndex, vValueData); - psbStorageBlock->SetValueDestructor(iValueIndex, fnValueDestructor); - - bResult = true; - } - else - { - bResult = AllocateAndSetStorageValue(hskStorageKey, iValueIndex, vValueData, fnValueDestructor); - } - - return bResult; - } - - static _OU_ALWAYSINLINE tlsvaluetype _OU_CONVENTION_API - /*tlsvaluetype */GetStorageValue(const HTLSKEY &hskStorageKey, tlsindextype iValueIndex) - { - tlsvaluetype vValueData = 0; - - CTLSStorageBlock *psbStorageBlock = GetKeyStorageBlock(hskStorageKey); - - if (psbStorageBlock) - { - vValueData = psbStorageBlock->GetValueData(iValueIndex); - } - - return vValueData; - } - -public: // Unsafe methods - static _OU_ALWAYSINLINE void _OU_CONVENTION_API - /*void */UnsafeSetStorageValue(const HTLSKEY &hskStorageKey, tlsindextype iValueIndex, tlsvaluetype vValueData) - { - CTLSStorageBlock *psbStorageBlock = GetKeyStorageBlock(hskStorageKey); - psbStorageBlock->SetValueData(iValueIndex, vValueData); - } - - static _OU_ALWAYSINLINE tlsvaluetype _OU_CONVENTION_API - /*tlsvaluetype */UnsafeGetStorageValue(const HTLSKEY &hskStorageKey, tlsindextype iValueIndex) - { - CTLSStorageBlock *psbStorageBlock = GetKeyStorageBlock(hskStorageKey); - return psbStorageBlock->GetValueData(iValueIndex); - } - -private: - static bool _OU_CONVENTION_API AllocateAndSetStorageValue(const HTLSKEYSELECTOR &hksKeySelector, - tlsindextype iValueIndex, tlsvaluetype vValueData, CTLSValueDestructor fnValueDestructor); - -private: - friend class CTLSInitialization; - - static inline void _OU_CONVENTION_API SetKeyStorageBlock(const HTLSKEYSELECTOR &hskStorageKey, CTLSStorageBlock *psbInstance) - { -#if _OU_TARGET_OS == _OU_TARGET_OS_WINDOWS - - ::TlsSetValue((DWORD)(size_t)(HTLSKEYVALUE::value_type)(*(HTLSKEYSELECTOR::value_type)hskStorageKey), (LPVOID)psbInstance); - - -#else // #if _OU_TARGET_OS != _OU_TARGET_OS_WINDOWS - - pthread_setspecific((pthread_key_t)(size_t)(HTLSKEYVALUE::value_type)(*(HTLSKEYSELECTOR::value_type)hskStorageKey), (void *)psbInstance); - - -#endif // #if _OU_TARGET_OS == ... - } - - static inline CTLSStorageBlock *_OU_CONVENTION_API GetKeyStorageBlock(const HTLSKEYSELECTOR &hskStorageKey) - { -#if _OU_TARGET_OS == _OU_TARGET_OS_WINDOWS - - CTLSStorageBlock *psbStorageBlock = (CTLSStorageBlock *)::TlsGetValue((DWORD)(size_t)(HTLSKEYVALUE::value_type)(*(HTLSKEYSELECTOR::value_type)hskStorageKey)); - - -#else // #if _OU_TARGET_OS != _OU_TARGET_OS_WINDOWS - - CTLSStorageBlock *psbStorageBlock = (CTLSStorageBlock *)pthread_getspecific((pthread_key_t)(size_t)(HTLSKEYVALUE::value_type)(*(HTLSKEYSELECTOR::value_type)hskStorageKey)); - - -#endif // #if _OU_TARGET_OS == ... - - return psbStorageBlock; - } -}; - - -////////////////////////////////////////////////////////////////////////// -// Initialization/finalization - -class CTLSInitialization -{ -public: - enum EINITIALIZATIONFLAGS - { - SIF_MANUAL_CLEANUP_ON_THREAD_EXIT = 0x00000001, - }; - -public: - // Initialization must be performed from main thread - static bool _OU_CONVENTION_API InitializeTLSAPI(HTLSKEY &hskOutStorageKey, tlsindextype iValueCount, - unsigned int uiInitializationFlags=0); - static void _OU_CONVENTION_API FinalizeTLSAPI(); - - static void _OU_CONVENTION_API CleanupOnThreadExit(); - -private: - static bool _OU_CONVENTION_API InitializeTLSAPIValidated(unsigned int uiInstanceKind, - tlsindextype iValueCount, unsigned int uiInitializationFlags); - static void _OU_CONVENTION_API FinalizeTLSAPIValidated(unsigned int uiInstanceKind); -}; - - -END_NAMESPACE_OU(); - - -#endif // #if _OU_FEATURE_SET >= _OU_FEATURE_SET_TLS - - -#endif // #ifndef _OU_THREADLOCALSTORAGE_H_INCLUDED +#include +#include +#include +#include +#include + +#if _OU_TARGET_OS == _OU_TARGET_OS_WINDOWS + +#include + + +#else // #if _OU_TARGET_OS != _OU_TARGET_OS_WINDOWS + +#include + + +#endif // #if _OU_TARGET_OS == ... + + +BEGIN_NAMESPACE_OU(); + + +////////////////////////////////////////////////////////////////////////// +// API specific types + +typedef CTypeSimpleWrapper HTLSKEYVALUE; +typedef CTypeSimpleWrapper HTLSKEYSELECTOR; +typedef HTLSKEYSELECTOR HTLSKEY; + +typedef void *tlsvaluetype; +typedef unsigned int tlsindextype; + +typedef void (_OU_CONVENTION_CALLBACK *CTLSValueDestructor)(tlsvaluetype vValueData); + + +#define OU_TLS_VALUE_AS_POINTER(value) (value) + + +////////////////////////////////////////////////////////////////////////// +// Internal types required for functions to be made inline + +struct CTLSStorageArray; + +struct CTLSStorageBlock +{ +/* + * Implementation Note: + * 1) Value destructors are stored in separate array since those are + * rarely accessed values and not intermixing them with data + * potentially simplifies data access (well, just theoretically, of course :)). + * 2) Destructors are stored with negative offset to allow accessing them + * without the knowledge of value count. + * 3) Well, intermixing or not intermixing has really minor impact on + * implementation characteristics, so why not to choose it after the current mood? :) + */ +private: + enum + { + TSB_RESERVEDPOINTER_HOSTARRAY, + + TSB_RESERVEDPOINTER__MAX, + }; + +public: + enum + { + TSB_LARGEST_ALIGNMENT = sizeof(void *) > sizeof(tlsvaluetype) ? sizeof(void *) : sizeof(tlsvaluetype), + }; + +public: + static inline size_t GetRequiredSize(tlsindextype iValueCount) + { + return OU_ALIGNED_SIZE(iValueCount * (sizeof(tlsvaluetype) + sizeof(CTLSValueDestructor)) + TSB_RESERVEDPOINTER__MAX * sizeof(void *), TSB_LARGEST_ALIGNMENT); + } + + static inline size_t GetZeroOffset(tlsindextype iValueCount) + { + // Since pointers and values are stored in different directions, + // alignment correction must fall entirely to either side and + // required size will not be exceeded. + return OU_ALIGNED_SIZE(iValueCount * sizeof(CTLSValueDestructor) + TSB_RESERVEDPOINTER__MAX * sizeof(void *), TSB_LARGEST_ALIGNMENT); + } + +public: + inline void SetValueData(tlsindextype iValueIndex, tlsvaluetype vValueData) + { + un.m_av_ValueDatas[iValueIndex] = vValueData; + } + + inline tlsvaluetype GetValueData(tlsindextype iValueIndex) const + { + return un.m_av_ValueDatas[iValueIndex]; + } + + inline void SetHostArray(CTLSStorageArray *psaInstance) + { + un.m_asaHostArrays[(ptrdiff_t)0 - (1 + TSB_RESERVEDPOINTER_HOSTARRAY)] = psaInstance; + } + + inline CTLSStorageArray *GetHostArray() const + { + return un.m_asaHostArrays[(ptrdiff_t)0 - (1 + TSB_RESERVEDPOINTER_HOSTARRAY)]; + } + + inline void SetValueDestructor(tlsindextype iValueIndex, CTLSValueDestructor fvValue) + { + un.m_afnValueDestructors[-((ptrdiff_t)iValueIndex) - (1 + TSB_RESERVEDPOINTER__MAX)] = fvValue; + } + + inline CTLSValueDestructor GetValueDestructor(tlsindextype iValueIndex) const + { + return un.m_afnValueDestructors[-((ptrdiff_t)iValueIndex) - (1 + TSB_RESERVEDPOINTER__MAX)]; + } + +private: + union + { + tlsvaluetype m_av_ValueDatas[1]; + CTLSValueDestructor m_afnValueDestructors[1]; + CTLSStorageArray *m_asaHostArrays[1]; + } un; +}; + + +////////////////////////////////////////////////////////////////////////// +// API declaration + +class CThreadLocalStorage +{ +public: // Safe methods + /* + * Implementation Note: + * Since the function is potentially slow and should not be frequently + * called anyway, there is no sense in creating additional overload without + * destructor parameter which would preserve current destructor procedure. + */ + static _OU_ALWAYSINLINE bool _OU_CONVENTION_API + /*bool */SetStorageValue(const HTLSKEY &hskStorageKey, tlsindextype iValueIndex, tlsvaluetype vValueData, CTLSValueDestructor fnValueDestructor=NULL) + { + bool bResult; + + CTLSStorageBlock *psbStorageBlock = GetKeyStorageBlock(hskStorageKey); + + if (psbStorageBlock) + { + psbStorageBlock->SetValueData(iValueIndex, vValueData); + psbStorageBlock->SetValueDestructor(iValueIndex, fnValueDestructor); + + bResult = true; + } + else + { + bResult = AllocateAndSetStorageValue(hskStorageKey, iValueIndex, vValueData, fnValueDestructor); + } + + return bResult; + } + + static _OU_ALWAYSINLINE tlsvaluetype _OU_CONVENTION_API + /*tlsvaluetype */GetStorageValue(const HTLSKEY &hskStorageKey, tlsindextype iValueIndex) + { + tlsvaluetype vValueData = 0; + + CTLSStorageBlock *psbStorageBlock = GetKeyStorageBlock(hskStorageKey); + + if (psbStorageBlock) + { + vValueData = psbStorageBlock->GetValueData(iValueIndex); + } + + return vValueData; + } + +public: // Unsafe methods + static _OU_ALWAYSINLINE void _OU_CONVENTION_API + /*void */UnsafeSetStorageValue(const HTLSKEY &hskStorageKey, tlsindextype iValueIndex, tlsvaluetype vValueData) + { + CTLSStorageBlock *psbStorageBlock = GetKeyStorageBlock(hskStorageKey); + psbStorageBlock->SetValueData(iValueIndex, vValueData); + } + + static _OU_ALWAYSINLINE tlsvaluetype _OU_CONVENTION_API + /*tlsvaluetype */UnsafeGetStorageValue(const HTLSKEY &hskStorageKey, tlsindextype iValueIndex) + { + CTLSStorageBlock *psbStorageBlock = GetKeyStorageBlock(hskStorageKey); + return psbStorageBlock->GetValueData(iValueIndex); + } + +private: + static bool _OU_CONVENTION_API AllocateAndSetStorageValue(const HTLSKEYSELECTOR &hksKeySelector, + tlsindextype iValueIndex, tlsvaluetype vValueData, CTLSValueDestructor fnValueDestructor); + +private: + friend class CTLSInitialization; + + static inline void _OU_CONVENTION_API SetKeyStorageBlock(const HTLSKEYSELECTOR &hskStorageKey, CTLSStorageBlock *psbInstance) + { +#if _OU_TARGET_OS == _OU_TARGET_OS_WINDOWS + + ::TlsSetValue((DWORD)(size_t)(HTLSKEYVALUE::value_type)(*(HTLSKEYSELECTOR::value_type)hskStorageKey), (LPVOID)psbInstance); + + +#else // #if _OU_TARGET_OS != _OU_TARGET_OS_WINDOWS + + pthread_setspecific((pthread_key_t)(size_t)(HTLSKEYVALUE::value_type)(*(HTLSKEYSELECTOR::value_type)hskStorageKey), (void *)psbInstance); + + +#endif // #if _OU_TARGET_OS == ... + } + + static inline CTLSStorageBlock *_OU_CONVENTION_API GetKeyStorageBlock(const HTLSKEYSELECTOR &hskStorageKey) + { +#if _OU_TARGET_OS == _OU_TARGET_OS_WINDOWS + + CTLSStorageBlock *psbStorageBlock = (CTLSStorageBlock *)::TlsGetValue((DWORD)(size_t)(HTLSKEYVALUE::value_type)(*(HTLSKEYSELECTOR::value_type)hskStorageKey)); + + +#else // #if _OU_TARGET_OS != _OU_TARGET_OS_WINDOWS + + CTLSStorageBlock *psbStorageBlock = (CTLSStorageBlock *)pthread_getspecific((pthread_key_t)(size_t)(HTLSKEYVALUE::value_type)(*(HTLSKEYSELECTOR::value_type)hskStorageKey)); + + +#endif // #if _OU_TARGET_OS == ... + + return psbStorageBlock; + } +}; + + +////////////////////////////////////////////////////////////////////////// +// Initialization/finalization + +class CTLSInitialization +{ +public: + enum EINITIALIZATIONFLAGS + { + SIF_MANUAL_CLEANUP_ON_THREAD_EXIT = 0x00000001, + }; + +public: + // Initialization must be performed from main thread + static bool _OU_CONVENTION_API InitializeTLSAPI(HTLSKEY &hskOutStorageKey, tlsindextype iValueCount, + unsigned int uiInitializationFlags=0); + static void _OU_CONVENTION_API FinalizeTLSAPI(); + + static void _OU_CONVENTION_API CleanupOnThreadExit(); + +private: + static bool _OU_CONVENTION_API InitializeTLSAPIValidated(unsigned int uiInstanceKind, + tlsindextype iValueCount, unsigned int uiInitializationFlags); + static void _OU_CONVENTION_API FinalizeTLSAPIValidated(unsigned int uiInstanceKind); +}; + + +END_NAMESPACE_OU(); + + +#endif // #if _OU_FEATURE_SET >= _OU_FEATURE_SET_TLS + + +#endif // #ifndef _OU_THREADLOCALSTORAGE_H_INCLUDED diff -Nru ode-0.16/ou/include/ou/typewrapper.h ode-0.16.2/ou/include/ou/typewrapper.h --- ode-0.16/ou/include/ou/typewrapper.h 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/include/ou/typewrapper.h 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/src/ou/atomic.cpp ode-0.16.2/ou/src/ou/atomic.cpp --- ode-0.16/ou/src/ou/atomic.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/src/ou/atomic.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/src/ou/customization.cpp ode-0.16.2/ou/src/ou/customization.cpp --- ode-0.16/ou/src/ou/customization.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/src/ou/customization.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/src/ou/malloc.cpp ode-0.16.2/ou/src/ou/malloc.cpp --- ode-0.16/ou/src/ou/malloc.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/src/ou/malloc.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or * diff -Nru ode-0.16/ou/src/ou/threadlocalstorage.cpp ode-0.16.2/ou/src/ou/threadlocalstorage.cpp --- ode-0.16/ou/src/ou/threadlocalstorage.cpp 2018-12-09 20:04:03.000000000 +0000 +++ ode-0.16.2/ou/src/ou/threadlocalstorage.cpp 2020-07-30 13:27:35.000000000 +0000 @@ -1,6 +1,6 @@ /************************************************************************* * * - * ODER's Utilities Library. Copyright (C) 2008 Oleh Derevenko. * + * ODER's Utilities Library. Copyright (C) 2008-2019 Oleh Derevenko. * * All rights reserved. e-mail: odar@eleks.com (change all "a" to "e") * * * * This library is free software; you can redistribute it and/or *