mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-24 11:25:30 +00:00
Another POSIX thread destructor fix (Issue #293)
This commit is contained in:
parent
e1dd7234b4
commit
d32818a16c
@ -1,7 +1,6 @@
|
||||
# Changes in Mini-XML 3.3.1
|
||||
|
||||
- Fixed a POSIX thread cleanup bug on macOS - per-thread data destructor called
|
||||
twice.
|
||||
- Fixed POSIX thread cleanup bugs (Issue #293)
|
||||
|
||||
|
||||
# Changes in Mini-XML 3.3
|
||||
|
2
NOTICE
2
NOTICE
@ -1,6 +1,6 @@
|
||||
Mini-XML
|
||||
|
||||
Copyright © 2003-2020 by Michael R Sweet
|
||||
Copyright © 2003-2022 by Michael R Sweet
|
||||
|
||||
|
||||
(Optional) Exceptions to the Apache 2.0 License:
|
||||
|
@ -199,7 +199,7 @@ current version of this software, documentation, and Github issue tracking page.
|
||||
Legal Stuff
|
||||
-----------
|
||||
|
||||
Copyright © 2003-2021 by Michael R Sweet
|
||||
Copyright © 2003-2022 by Michael R Sweet
|
||||
|
||||
The Mini-XML library is licensed under the Apache License Version 2.0 with an
|
||||
*optional* exception to allow linking against GPL2/LGPL2-only software. See the
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* https://www.msweet.org/mxml
|
||||
*
|
||||
* Copyright © 2003-2021 by Michael R Sweet.
|
||||
* Copyright © 2003-2022 by Michael R Sweet.
|
||||
*
|
||||
* Licensed under Apache License v2.0. See the file "LICENSE" for more
|
||||
* information.
|
||||
@ -26,7 +26,7 @@
|
||||
* be unloaded safely, although since there is no standard way to do so I
|
||||
* can't even provide any guarantees that you can do it safely on all platforms.
|
||||
*
|
||||
* This code currently supports AIX, HP-UX, Linux, Mac OS X, Solaris, and
|
||||
* This code currently supports AIX, HP-UX, Linux, macOS, Solaris, and
|
||||
* Windows. It might work on the BSDs and IRIX, but I haven't tested that.
|
||||
*/
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
#elif defined(__hpux)
|
||||
# pragma FINI _mxml_fini
|
||||
# define _MXML_FINI _mxml_fini
|
||||
#elif defined(__GNUC__) /* Linux and Mac OS X */
|
||||
#elif defined(__GNUC__) /* Linux and macOS */
|
||||
# define _MXML_FINI __attribute((destructor)) _mxml_fini
|
||||
#else
|
||||
# define _MXML_FINI _fini
|
||||
@ -140,6 +140,8 @@ mxml_real_cb(mxml_node_t *node) /* I - Current node */
|
||||
#ifdef HAVE_PTHREAD_H /**** POSIX threading ****/
|
||||
# include <pthread.h>
|
||||
|
||||
static int _mxml_initialized = 0;
|
||||
/* Have we been initialized? */
|
||||
static pthread_key_t _mxml_key; /* Thread local storage key */
|
||||
static pthread_once_t _mxml_key_once = PTHREAD_ONCE_INIT;
|
||||
/* One-time initialization object */
|
||||
@ -165,7 +167,8 @@ _mxml_destructor(void *g) /* I - Global data */
|
||||
static void
|
||||
_MXML_FINI(void)
|
||||
{
|
||||
pthread_key_delete(_mxml_key);
|
||||
if (_mxml_initialized)
|
||||
pthread_key_delete(_mxml_key);
|
||||
}
|
||||
|
||||
|
||||
@ -202,6 +205,7 @@ _mxml_global(void)
|
||||
static void
|
||||
_mxml_init(void)
|
||||
{
|
||||
_mxml_initialized = 1;
|
||||
pthread_key_create(&_mxml_key, _mxml_destructor);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user