Properly initialize libxml2

When libxml2 is to be used in a multi-threaded application, the
xmlInitThreads() function must be called before any other libxml2
function.  This function does different things on various platforms and
thus one can get away without calling it on Unix systems, but not on
Windows, where it initializes critical section objects used for
synchronizing access to data structures shared between threads.  Add the
missing xmlInitThreads() call to prevent crashes on affected systems.

Also add a matching xmlCleanupThreads() call to properly release the
resources set up by xmlInitThreads().
62 jobs for !2386 with michal/properly-initialize-libxml2 in 19 minutes and 43 seconds (queued for 5 seconds)
detached
Status Job ID Name Coverage
  Precheck
passed #335340
amd64 linux
🐞:sid:amd64

00:02:02

passed #335338
amd64 linux
autoreconf:sid:amd64

00:00:33

passed #335339
amd64 linux
misc:sid:amd64

00:00:17

 
  Build
passed #335352
amd64 linux
asan:sid:amd64

00:02:13

passed #335358
amd64 freebsd
clang:freebsd11.3:amd64

00:01:17

passed #335359
amd64 freebsd
clang:freebsd12.0:amd64

00:01:07

passed #335355
amd64 linux
clang:stretch:amd64

00:02:10

passed #335356
i386 linux
clang:stretch:i386

00:02:03

passed #335341
amd64 linux
gcc:alpine3.10:amd64

00:03:22

passed #335351
amd64 linux
gcc:bionic:amd64

00:02:20

passed #335346
i386 linux
gcc:buster:amd64

00:01:52

passed #335342
amd64 linux
gcc:centos6:amd64

00:02:50

passed #335343
amd64 linux
gcc:centos7:amd64

00:03:00

passed #335349
amd64 linux
gcc:fedora30:amd64

00:02:56

passed #335344
amd64 linux
gcc:jessie:amd64

00:01:41

passed #335347
amd64 linux
gcc:sid:amd64

00:02:06

passed #335348
i386 linux
gcc:sid:i386

00:02:20

passed #335345
amd64 linux
gcc:stretch:amd64

00:02:17

passed #335350
amd64 linux
gcc:xenial:amd64

00:01:59

passed #335354
amd64 linux
mutexatomics:sid:amd64

00:02:19

passed #335360
amd64 linux
nolibtool:sid:amd64

00:02:22

passed #335357
amd64 linux
pkcs11:sid:amd64

00:01:52

passed #335353
amd64 linux
rwlock:sid:amd64

00:01:57

 
  Unit
passed #335372
amd64 linux
unit:asan:sid:amd64

00:04:55

passed #335376
amd64 freebsd
unit:clang:freebsd11.3:amd64

00:00:24

passed #335377
amd64 freebsd
unit:clang:freebsd12.0:amd64

00:01:04

passed #335374
amd64 linux
unit:clang:stretch:amd64

00:00:44

passed #335361
amd64 linux
unit:gcc:alpine3.10:amd64

00:02:56

passed #335371
amd64 linux
unit:gcc:bionic:amd64

00:00:56

passed #335366
i386 linux
unit:gcc:buster:amd64

00:01:27

passed #335362
amd64 linux
unit:gcc:centos6:amd64

00:00:48

passed #335363
amd64 linux
unit:gcc:centos7:amd64

00:00:49

passed #335369
amd64 linux
unit:gcc:fedora30:amd64

00:01:24

passed #335364
amd64 linux
unit:gcc:jessie:amd64

00:00:30

passed #335367
amd64 linux
unit:gcc:sid:amd64

00:01:51

passed #335368
i386 linux
unit:gcc:sid:i386

00:01:55

passed #335365
amd64 linux
unit:gcc:stretch:amd64

00:00:47

passed #335370
amd64 linux
unit:gcc:xenial:amd64

00:00:47

passed #335378
amd64 linux
unit:nolibtool:sid:amd64

00:01:48

passed #335375
amd64 linux
unit:pkcs11:sid:amd64

00:01:29

passed #335373
amd64 linux
unit:rwlock:sid:amd64

00:01:35

 
  System
passed #335390
amd64 linux
system:asan:sid:amd64

00:09:35

passed #335393
amd64 freebsd
system:clang:freebsd11.3:amd64

00:06:27

passed #335394
amd64 freebsd
system:clang:freebsd12.0:amd64

00:06:38

passed #335379
amd64 linux
system:gcc:alpine3.10:amd64

00:08:24

passed #335389
amd64 linux
system:gcc:bionic:amd64

00:07:36

passed #335384
i386 linux
system:gcc:buster:amd64

00:08:07

passed #335398
linux amd64
system:gcc:centos6:amd64

00:06:38

passed #335381
amd64 linux
system:gcc:centos7:amd64

00:07:27

passed #335387
amd64 linux
system:gcc:fedora30:amd64

00:07:48

passed #335382
amd64 linux
system:gcc:jessie:amd64

00:07:05

passed #335385
amd64 linux
system:gcc:sid:amd64

00:08:31

passed #335399
linux i386
system:gcc:sid:i386

00:07:15

passed #335383
amd64 linux
system:gcc:stretch:amd64

00:07:26

passed #335388
amd64 linux
system:gcc:xenial:amd64

00:07:52

passed #335400
linux amd64
system:nolibtool:sid:amd64

00:06:59

passed #335392
amd64 linux
system:pkcs11:sid:amd64

00:08:05

passed #335391
amd64 linux
system:rwlock:sid:amd64

00:08:12

failed #335380
amd64 linux
system:gcc:centos6:amd64

00:07:45

failed #335386
i386 linux
system:gcc:sid:i386

00:08:20

failed #335395
amd64 linux
system:nolibtool:sid:amd64

00:08:45

 
  Docs
passed #335396
amd64 linux
docs:sid:amd64

00:01:13