Created
December 23, 2013 08:16
-
-
Save blackwithwhite666/8093366 to your computer and use it in GitHub Desktop.
Revisions
-
blackwithwhite666 created this gist
Dec 23, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ diff --git a/setup.py b/setup.py index 67ddc8f..4a957e0 100644 --- a/setup.py +++ b/setup.py @@ -37,6 +37,7 @@ setup(name = "pyuv", 'sdist' : libuv_sdist}, ext_modules = [Extension('pyuv', sources = ['src/pyuv.c'], + extra_compile_args=['-std=c99'], define_macros=[('MODULE_VERSION', __version__), ('LIBUV_REVISION', libuv_build_ext.libuv_revision)] )] diff --git a/src/pyuv.h b/src/pyuv.h index 885071f..3d43537 100644 --- a/src/pyuv.h +++ b/src/pyuv.h @@ -28,6 +28,14 @@ typedef int Bool; #define True 1 #define False 0 +/* Standart lib */ +#if defined(__clang__) + #define _Thread_local __thread +#elif defined(__GNUC__) || defined(__GNUG__) + #define _Thread_local __thread +#else + #define _Thread_local +#endif /* Utility macros */ #define PYUV_STRINGIFY_HELPER(x) #x diff --git a/src/stream.c b/src/stream.c index 903a380..08989c8 100644 --- a/src/stream.c +++ b/src/stream.c @@ -19,7 +19,7 @@ typedef struct { static void on_stream_alloc(uv_stream_t* handle, size_t suggested_size, uv_buf_t *buf) { - static char slab[PYUV_SLAB_SIZE]; + static _Thread_local char slab[PYUV_SLAB_SIZE]; UNUSED_ARG(handle); buf->base = slab; buf->len = sizeof(slab);