[med-svn] [libdisorder] 01/01: Ensure thread-safety.

Guus Sliepen guus at moszumanska.debian.org
Mon Jun 27 21:53:33 UTC 2016


This is an automated email from the git hooks/post-receive script.

guus pushed a commit to branch master
in repository libdisorder.

commit 35bd9bedc4d0f4623c39c99c0c503b720a394828
Author: Guus Sliepen <guus at debian.org>
Date:   Mon Jun 27 23:50:33 2016 +0200

    Ensure thread-safety.
    
    The library uses static variables to store the results. To ensure
    thead-safety, make them all thread-local.
---
 debian/patches/series              |  1 +
 debian/patches/thread-safety.patch | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/debian/patches/series b/debian/patches/series
index a7a9410..36825b1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
+thread-safety.patch
 cpp.patch
 autoconf.patch
diff --git a/debian/patches/thread-safety.patch b/debian/patches/thread-safety.patch
new file mode 100644
index 0000000..a3500a3
--- /dev/null
+++ b/debian/patches/thread-safety.patch
@@ -0,0 +1,21 @@
+--- a/src/disorder.c
++++ b/src/disorder.c
+@@ -30,12 +30,12 @@
+ #endif
+ 
+ /** Frequecies for each byte */
+-static int m_token_freqs[LIBDO_MAX_BYTES]; //frequency of each token in sample
+-static float m_token_probs[LIBDO_MAX_BYTES]; //P(each token appearing)
+-static int m_num_tokens = 0; //actual number of `seen' tokens, max 256 
+-static float m_maxent = 0.0;
+-static float m_ratio = 0.0;
+-static int LIBDISORDER_INITIALIZED = 0;
++static __thread int m_token_freqs[LIBDO_MAX_BYTES]; //frequency of each token in sample
++static __thread float m_token_probs[LIBDO_MAX_BYTES]; //P(each token appearing)
++static __thread int m_num_tokens = 0; //actual number of `seen' tokens, max 256
++static __thread float m_maxent = 0.0;
++static __thread float m_ratio = 0.0;
++static __thread int LIBDISORDER_INITIALIZED = 0;
+ 
+ static void
+ initialize_lib()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/libdisorder.git



More information about the debian-med-commit mailing list