1/* ______ ___ ___ 2 * /\ _ \ /\_ \ /\_ \ 3 * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___ 4 * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\ 5 * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \ 6 * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/ 7 * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/ 8 * /\____/ 9 * \_/__/ 10 * 11 * Thread local storage. 12 * 13 * See LICENSE.txt for copyright information. 14 */ 15 16#if defined(ALLEGRO_MSVC) || defined(ALLEGRO_BCC32) 17 #define THREAD_LOCAL_QUALIFIER __declspec(thread) 18#else 19 #define THREAD_LOCAL_QUALIFIER __thread 20#endif 21 22static THREAD_LOCAL_QUALIFIER thread_local_state _tls; 23 24 25void _al_tls_init_once(void) 26{ 27 /* nothing */ 28} 29 30 31static thread_local_state *tls_get(void) 32{ 33 static THREAD_LOCAL_QUALIFIER thread_local_state *ptr = NULL; 34 if (!ptr) { 35 ptr = &_tls; 36 initialize_tls_values(ptr); 37 } 38 return ptr; 39} 40 41 42/* vim: set ft=c sts=3 sw=3 et: */ 43