diff libgsmefr/tls_flags.c @ 38:38326102fc43

libgsmefr: beginning to integrate code from ETSI
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 24 Nov 2022 05:30:03 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgsmefr/tls_flags.c	Thu Nov 24 05:30:03 2022 +0000
@@ -0,0 +1,18 @@
+/*
+ * Unfortunately the code we got from ETSI makes heavy use of two global
+ * Boolean flags named Carry and Overflow that function like equally named
+ * processor state flags on many CPU architectures.  They are not part
+ * of persistent codec session state for either the encoder or the decoder,
+ * instead they are "short-term" globals much like UNIX errno.
+ *
+ * Given this unfortunate reality plus the natural desire to make our
+ * EFR library thread-safe (a transcoding MGW handling a large volume of
+ * simultaneous calls is exactly the kind of application that would benefit
+ * from utilitizing all CPU cores), our current workaround is to use
+ * thread-local storage.
+ */
+
+#include <stdint.h>
+#include "typedef.h"
+
+__thread Flag EFR__Carry, EFR__Overflow;