Package: libdisorder / 0.0.2+git20130809.8062ee1-2

thread-safety.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Author: Guus Sliepen <guus@debian.org>
Last-Update: 2016-06-28 00:05:18 +0200
Description: Make library thread-safe

--- a/code/src/disorder.c
+++ b/code/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()