make threadlocal use conditional on configure check. NB: This revision mixes GPLv2-only and GPLv3+ code so should be considered proof of concept.

This commit is contained in:
Jan Kanis
2013-01-23 01:03:12 +01:00
parent 70a75dc88a
commit d12b1650aa
2 changed files with 41 additions and 1 deletions

View File

@@ -184,7 +184,9 @@ commence.
static volatile unsigned int s_generation_count;
/* This threadlocal generation count is set when an autosuggestion background thread starts up, so it can easily check if the work it is doing is no longer useful. */
static __thread unsigned int thread_generation_count;
#ifdef TLS
static TLS unsigned int thread_generation_count;
#endif
/* A color is an int */
typedef int color_t;
@@ -672,8 +674,12 @@ int reader_reading_interrupted()
bool reader_cancel_thread()
{
#ifdef TLS
ASSERT_IS_BACKGROUND_THREAD();
return s_generation_count != thread_generation_count;
#else
return 0;
#endif
}
void reader_write_title()
@@ -1234,7 +1240,9 @@ struct autosuggestion_context_t
return 0;
}
#ifdef TLS
thread_generation_count = generation_count;
#endif
/* Let's make sure we aren't using the empty string */
if (search_string.empty())