[pypy-commit] pypy default: Rename the flag "threadsafe" to rffi.llexternal() into "releasegil", which

arigo noreply at buildbot.pypy.org
Sun Sep 15 17:00:38 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r66954:837ec9da7885
Date: 2013-09-15 16:59 +0200
http://bitbucket.org/pypy/pypy/changeset/837ec9da7885/

Log:	Rename the flag "threadsafe" to rffi.llexternal() into "releasegil",
	which is what it really means.

diff --git a/pypy/module/__pypy__/interp_time.py b/pypy/module/__pypy__/interp_time.py
--- a/pypy/module/__pypy__/interp_time.py
+++ b/pypy/module/__pypy__/interp_time.py
@@ -48,11 +48,11 @@
 
     c_clock_gettime = rffi.llexternal("clock_gettime",
         [lltype.Signed, lltype.Ptr(TIMESPEC)], rffi.INT,
-        compilation_info=CConfig._compilation_info_, threadsafe=False
+        compilation_info=CConfig._compilation_info_, releasegil=False
     )
     c_clock_getres = rffi.llexternal("clock_getres",
         [lltype.Signed, lltype.Ptr(TIMESPEC)], rffi.INT,
-        compilation_info=CConfig._compilation_info_, threadsafe=False
+        compilation_info=CConfig._compilation_info_, releasegil=False
     )
 
     @unwrap_spec(clk_id="c_int")
diff --git a/pypy/module/_multiprocessing/interp_semaphore.py b/pypy/module/_multiprocessing/interp_semaphore.py
--- a/pypy/module/_multiprocessing/interp_semaphore.py
+++ b/pypy/module/_multiprocessing/interp_semaphore.py
@@ -28,7 +28,7 @@
         'CreateSemaphoreA', [rffi.VOIDP, rffi.LONG, rffi.LONG, rwin32.LPCSTR],
         rwin32.HANDLE)
     _CloseHandle = rwin32.winexternal('CloseHandle', [rwin32.HANDLE],
-        rwin32.BOOL, threadsafe=False)
+        rwin32.BOOL, releasegil=False)
     _ReleaseSemaphore = rwin32.winexternal(
         'ReleaseSemaphore', [rwin32.HANDLE, rffi.LONG, rffi.LONGP],
         rwin32.BOOL)
@@ -82,8 +82,8 @@
     _sem_open = external('sem_open',
                          [rffi.CCHARP, rffi.INT, rffi.INT, rffi.UINT],
                          SEM_T)
-    # tread sem_close as not threadsafe for now to be able to use the __del__
-    _sem_close = external('sem_close', [SEM_T], rffi.INT, threadsafe=False)
+    # sem_close is releasegil=False to be able to use it in the __del__
+    _sem_close = external('sem_close', [SEM_T], rffi.INT, releasegil=False)
     _sem_unlink = external('sem_unlink', [rffi.CCHARP], rffi.INT)
     _sem_wait = external('sem_wait', [SEM_T], rffi.INT)
     _sem_trywait = external('sem_trywait', [SEM_T], rffi.INT)
diff --git a/pypy/module/bz2/interp_bz2.py b/pypy/module/bz2/interp_bz2.py
--- a/pypy/module/bz2/interp_bz2.py
+++ b/pypy/module/bz2/interp_bz2.py
@@ -144,12 +144,12 @@
 BZ2_bzCompressInit = external('BZ2_bzCompressInit', [bz_stream, rffi.INT,
                               rffi.INT, rffi.INT], rffi.INT)
 BZ2_bzCompressEnd = external('BZ2_bzCompressEnd', [bz_stream], rffi.INT,
-                             threadsafe=False)
+                             releasegil=False)
 BZ2_bzCompress = external('BZ2_bzCompress', [bz_stream, rffi.INT], rffi.INT)
 BZ2_bzDecompressInit = external('BZ2_bzDecompressInit', [bz_stream, rffi.INT,
                                                          rffi.INT], rffi.INT)
 BZ2_bzDecompressEnd = external('BZ2_bzDecompressEnd', [bz_stream], rffi.INT,
-                               threadsafe=False)
+                               releasegil=False)
 BZ2_bzDecompress = external('BZ2_bzDecompress', [bz_stream], rffi.INT)
 
 def _catch_bz2_error(space, bzerror):
diff --git a/pypy/module/cppyy/capi/builtin_capi.py b/pypy/module/cppyy/capi/builtin_capi.py
--- a/pypy/module/cppyy/capi/builtin_capi.py
+++ b/pypy/module/cppyy/capi/builtin_capi.py
@@ -27,7 +27,7 @@
 _c_num_scopes = rffi.llexternal(
     "cppyy_num_scopes",
     [C_SCOPE], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_num_scopes(space, cppscope):
     return _c_num_scopes(cppscope.handle)
@@ -41,28 +41,28 @@
 _c_resolve_name = rffi.llexternal(
     "cppyy_resolve_name",
     [rffi.CCHARP], rffi.CCHARP,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_resolve_name(space, name):
     return charp2str_free(space, _c_resolve_name(name))
 _c_get_scope_opaque = rffi.llexternal(
     "cppyy_get_scope",
     [rffi.CCHARP], C_SCOPE,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_get_scope_opaque(space, name):
     return _c_get_scope_opaque(name)
 _c_get_template = rffi.llexternal(
     "cppyy_get_template",
     [rffi.CCHARP], C_TYPE,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_get_template(space, name):
     return _c_get_template(name)
 _c_actual_class = rffi.llexternal(
     "cppyy_actual_class",
     [C_TYPE, C_OBJECT], C_TYPE,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_actual_class(space, cppclass, cppobj):
     return _c_actual_class(cppclass.handle, cppobj)
@@ -71,21 +71,21 @@
 _c_allocate = rffi.llexternal(
     "cppyy_allocate",
     [C_TYPE], C_OBJECT,
-    threadsafe=ts_memory,
+    releasegil=ts_memory,
     compilation_info=backend.eci)
 def c_allocate(space, cppclass):
     return _c_allocate(cppclass.handle)
 _c_deallocate = rffi.llexternal(
     "cppyy_deallocate",
     [C_TYPE, C_OBJECT], lltype.Void,
-    threadsafe=ts_memory,
+    releasegil=ts_memory,
     compilation_info=backend.eci)
 def c_deallocate(space, cppclass, cppobject):
     _c_deallocate(cppclass.handle, cppobject)
 _c_destruct = rffi.llexternal(
     "cppyy_destruct",
     [C_TYPE, C_OBJECT], lltype.Void,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_destruct(space, cppclass, cppobject):
     _c_destruct(cppclass.handle, cppobject)
@@ -94,63 +94,63 @@
 _c_call_v = rffi.llexternal(
     "cppyy_call_v",
     [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], lltype.Void,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_call_v(space, cppmethod, cppobject, nargs, args):
     _c_call_v(cppmethod, cppobject, nargs, args)
 _c_call_b = rffi.llexternal(
     "cppyy_call_b",
     [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.UCHAR,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_call_b(space, cppmethod, cppobject, nargs, args):
     return _c_call_b(cppmethod, cppobject, nargs, args)
 _c_call_c = rffi.llexternal(
     "cppyy_call_c",
     [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.CHAR,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_call_c(space, cppmethod, cppobject, nargs, args):
     return _c_call_c(cppmethod, cppobject, nargs, args)
 _c_call_h = rffi.llexternal(
     "cppyy_call_h",
     [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.SHORT,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_call_h(space, cppmethod, cppobject, nargs, args):
     return _c_call_h(cppmethod, cppobject, nargs, args)
 _c_call_i = rffi.llexternal(
     "cppyy_call_i",
     [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.INT,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_call_i(space, cppmethod, cppobject, nargs, args):
     return _c_call_i(cppmethod, cppobject, nargs, args)
 _c_call_l = rffi.llexternal(
     "cppyy_call_l",
     [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.LONG,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_call_l(space, cppmethod, cppobject, nargs, args):
     return _c_call_l(cppmethod, cppobject, nargs, args)
 _c_call_ll = rffi.llexternal(
     "cppyy_call_ll",
     [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.LONGLONG,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_call_ll(space, cppmethod, cppobject, nargs, args):
     return _c_call_ll(cppmethod, cppobject, nargs, args)
 _c_call_f = rffi.llexternal(
     "cppyy_call_f",
     [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.FLOAT,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_call_f(space, cppmethod, cppobject, nargs, args):
     return _c_call_f(cppmethod, cppobject, nargs, args)
 _c_call_d = rffi.llexternal(
     "cppyy_call_d",
     [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.DOUBLE,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_call_d(space, cppmethod, cppobject, nargs, args):
     return _c_call_d(cppmethod, cppobject, nargs, args)
@@ -158,14 +158,14 @@
 _c_call_r = rffi.llexternal(
     "cppyy_call_r",
     [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.VOIDP,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_call_r(space, cppmethod, cppobject, nargs, args):
     return _c_call_r(cppmethod, cppobject, nargs, args)
 _c_call_s = rffi.llexternal(
     "cppyy_call_s",
     [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.CCHARP,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_call_s(space, cppmethod, cppobject, nargs, args):
     return _c_call_s(cppmethod, cppobject, nargs, args)
@@ -173,14 +173,14 @@
 _c_constructor = rffi.llexternal(
     "cppyy_constructor",
     [C_METHOD, C_TYPE, rffi.INT, rffi.VOIDP], C_OBJECT,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_constructor(space, cppmethod, cppobject, nargs, args):
     return _c_constructor(cppmethod, cppobject, nargs, args)
 _c_call_o = rffi.llexternal(
     "cppyy_call_o",
     [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP, C_TYPE], rffi.LONG,
-    threadsafe=ts_call,
+    releasegil=ts_call,
     compilation_info=backend.eci)
 def c_call_o(space, method, cppobj, nargs, args, cppclass):
     return _c_call_o(method, cppobj, nargs, args, cppclass.handle)
@@ -188,7 +188,7 @@
 _c_get_methptr_getter = rffi.llexternal(
     "cppyy_get_methptr_getter",
     [C_SCOPE, C_INDEX], C_METHPTRGETTER_PTR,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci,
     elidable_function=True)
 def c_get_methptr_getter(space, cppscope, index):
@@ -198,21 +198,21 @@
 _c_allocate_function_args = rffi.llexternal(
     "cppyy_allocate_function_args",
     [rffi.SIZE_T], rffi.VOIDP,
-    threadsafe=ts_memory,
+    releasegil=ts_memory,
     compilation_info=backend.eci)
 def c_allocate_function_args(space, size):
     return _c_allocate_function_args(size)
 _c_deallocate_function_args = rffi.llexternal(
     "cppyy_deallocate_function_args",
     [rffi.VOIDP], lltype.Void,
-    threadsafe=ts_memory,
+    releasegil=ts_memory,
     compilation_info=backend.eci)
 def c_deallocate_function_args(space, args):
     _c_deallocate_function_args(args)
 _c_function_arg_sizeof = rffi.llexternal(
     "cppyy_function_arg_sizeof",
     [], rffi.SIZE_T,
-    threadsafe=ts_memory,
+    releasegil=ts_memory,
     compilation_info=backend.eci,
     elidable_function=True)
 def c_function_arg_sizeof(space):
@@ -220,7 +220,7 @@
 _c_function_arg_typeoffset = rffi.llexternal(
     "cppyy_function_arg_typeoffset",
     [], rffi.SIZE_T,
-    threadsafe=ts_memory,
+    releasegil=ts_memory,
     compilation_info=backend.eci,
     elidable_function=True)
 def c_function_arg_typeoffset(space):
@@ -230,14 +230,14 @@
 _c_is_namespace = rffi.llexternal(
     "cppyy_is_namespace",
     [C_SCOPE], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_is_namespace(space, scope):
     return _c_is_namespace(scope)
 _c_is_enum = rffi.llexternal(
     "cppyy_is_enum",
     [rffi.CCHARP], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_is_enum(space, name):
     return _c_is_enum(name)
@@ -246,42 +246,42 @@
 _c_final_name = rffi.llexternal(
     "cppyy_final_name",
     [C_TYPE], rffi.CCHARP,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_final_name(space, cpptype):
     return charp2str_free(space, _c_final_name(cpptype))
 _c_scoped_final_name = rffi.llexternal(
     "cppyy_scoped_final_name",
     [C_TYPE], rffi.CCHARP,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_scoped_final_name(space, cpptype):
     return charp2str_free(space, _c_scoped_final_name(cpptype))
 _c_has_complex_hierarchy = rffi.llexternal(
     "cppyy_has_complex_hierarchy",
     [C_TYPE], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_has_complex_hierarchy(space, cpptype):
     return _c_has_complex_hierarchy(cpptype)
 _c_num_bases = rffi.llexternal(
     "cppyy_num_bases",
     [C_TYPE], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_num_bases(space, cppclass):
     return _c_num_bases(cppclass.handle)
 _c_base_name = rffi.llexternal(
     "cppyy_base_name",
     [C_TYPE, rffi.INT], rffi.CCHARP,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_base_name(space, cppclass, base_index):
     return charp2str_free(space, _c_base_name(cppclass.handle, base_index))
 _c_is_subtype = rffi.llexternal(
     "cppyy_is_subtype",
     [C_TYPE, C_TYPE], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci,
     elidable_function=True)
 @jit.elidable_promote('2')
@@ -293,7 +293,7 @@
 _c_base_offset = rffi.llexternal(
     "cppyy_base_offset",
     [C_TYPE, C_TYPE, C_OBJECT, rffi.INT], rffi.SIZE_T,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci,
     elidable_function=True)
 @jit.elidable_promote('1,2,4')
@@ -308,21 +308,21 @@
 _c_num_methods = rffi.llexternal(
     "cppyy_num_methods",
     [C_SCOPE], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_num_methods(space, cppscope):
     return _c_num_methods(cppscope.handle)
 _c_method_index_at = rffi.llexternal(
     "cppyy_method_index_at",
     [C_SCOPE, rffi.INT], C_INDEX,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_method_index_at(space, cppscope, imethod):
     return _c_method_index_at(cppscope.handle, imethod)
 _c_method_indices_from_name = rffi.llexternal(
     "cppyy_method_indices_from_name",
     [C_SCOPE, rffi.CCHARP], C_INDEX_ARRAY,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_method_indices_from_name(space, cppscope, name):
     indices = _c_method_indices_from_name(cppscope.handle, name)
@@ -341,49 +341,49 @@
 _c_method_name = rffi.llexternal(
     "cppyy_method_name",
     [C_SCOPE, C_INDEX], rffi.CCHARP,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_method_name(space, cppscope, index):
     return charp2str_free(space, _c_method_name(cppscope.handle, index))
 _c_method_result_type = rffi.llexternal(
     "cppyy_method_result_type",
     [C_SCOPE, C_INDEX], rffi.CCHARP,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_method_result_type(space, cppscope, index):
     return charp2str_free(space, _c_method_result_type(cppscope.handle, index))
 _c_method_num_args = rffi.llexternal(
     "cppyy_method_num_args",
     [C_SCOPE, C_INDEX], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_method_num_args(space, cppscope, index):
     return _c_method_num_args(cppscope.handle, index)
 _c_method_req_args = rffi.llexternal(
     "cppyy_method_req_args",
     [C_SCOPE, C_INDEX], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_method_req_args(space, cppscope, index):
     return _c_method_req_args(cppscope.handle, index)
 _c_method_arg_type = rffi.llexternal(
     "cppyy_method_arg_type",
     [C_SCOPE, C_INDEX, rffi.INT], rffi.CCHARP,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_method_arg_type(space, cppscope, index, arg_index):
     return charp2str_free(space, _c_method_arg_type(cppscope.handle, index, arg_index))
 _c_method_arg_default = rffi.llexternal(
     "cppyy_method_arg_default",
     [C_SCOPE, C_INDEX, rffi.INT], rffi.CCHARP,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_method_arg_default(space, cppscope, index, arg_index):
     return charp2str_free(space, _c_method_arg_default(cppscope.handle, index, arg_index))
 _c_method_signature = rffi.llexternal(
     "cppyy_method_signature",
     [C_SCOPE, C_INDEX], rffi.CCHARP,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_method_signature(space, cppscope, index):
     return charp2str_free(space, _c_method_signature(cppscope.handle, index))
@@ -391,19 +391,19 @@
 _c_method_is_template = rffi.llexternal(
     "cppyy_method_is_template",
     [C_SCOPE, C_INDEX], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_method_is_template(space, cppscope, index):
     return _c_method_is_template(cppscope.handle, index)
 _c_method_num_template_args = rffi.llexternal(
     "cppyy_method_num_template_args",
     [C_SCOPE, C_INDEX], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 _c_method_template_arg_name = rffi.llexternal(
     "cppyy_method_template_arg_name",
     [C_SCOPE, C_INDEX, C_INDEX], rffi.CCHARP,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_template_args(space, cppscope, index):
     nargs = _c_method_num_template_args(cppscope.handle, index)
@@ -415,14 +415,14 @@
 _c_get_method = rffi.llexternal(
     "cppyy_get_method",
     [C_SCOPE, C_INDEX], C_METHOD,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_get_method(space, cppscope, index):
     return _c_get_method(cppscope.handle, index)
 _c_get_global_operator = rffi.llexternal(
     "cppyy_get_global_operator",
     [C_SCOPE, C_SCOPE, C_SCOPE, rffi.CCHARP], WLAVC_INDEX,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_get_global_operator(space, nss, lc, rc, op):
     if nss is not None:
@@ -433,14 +433,14 @@
 _c_is_constructor = rffi.llexternal(
     "cppyy_is_constructor",
     [C_TYPE, C_INDEX], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_is_constructor(space, cppclass, index):
     return _c_is_constructor(cppclass.handle, index)
 _c_is_staticmethod = rffi.llexternal(
     "cppyy_is_staticmethod",
     [C_TYPE, C_INDEX], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_is_staticmethod(space, cppclass, index):
     return _c_is_staticmethod(cppclass.handle, index)
@@ -449,28 +449,28 @@
 _c_num_datamembers = rffi.llexternal(
     "cppyy_num_datamembers",
     [C_SCOPE], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_num_datamembers(space, cppscope):
     return _c_num_datamembers(cppscope.handle)
 _c_datamember_name = rffi.llexternal(
     "cppyy_datamember_name",
     [C_SCOPE, rffi.INT], rffi.CCHARP,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_datamember_name(space, cppscope, datamember_index):
     return charp2str_free(space, _c_datamember_name(cppscope.handle, datamember_index))
 _c_datamember_type = rffi.llexternal(
     "cppyy_datamember_type",
     [C_SCOPE, rffi.INT], rffi.CCHARP,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_datamember_type(space, cppscope, datamember_index):
     return charp2str_free(space, _c_datamember_type(cppscope.handle, datamember_index))
 _c_datamember_offset = rffi.llexternal(
     "cppyy_datamember_offset",
     [C_SCOPE, rffi.INT], rffi.SIZE_T,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_datamember_offset(space, cppscope, datamember_index):
     return _c_datamember_offset(cppscope.handle, datamember_index)
@@ -478,7 +478,7 @@
 _c_datamember_index = rffi.llexternal(
     "cppyy_datamember_index",
     [C_SCOPE, rffi.CCHARP], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_datamember_index(space, cppscope, name):
     return _c_datamember_index(cppscope.handle, name)
@@ -487,14 +487,14 @@
 _c_is_publicdata = rffi.llexternal(
     "cppyy_is_publicdata",
     [C_SCOPE, rffi.INT], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_is_publicdata(space, cppscope, datamember_index):
     return _c_is_publicdata(cppscope.handle, datamember_index)
 _c_is_staticdata = rffi.llexternal(
     "cppyy_is_staticdata",
     [C_SCOPE, rffi.INT], rffi.INT,
-    threadsafe=ts_reflect,
+    releasegil=ts_reflect,
     compilation_info=backend.eci)
 def c_is_staticdata(space, cppscope, datamember_index):
     return _c_is_staticdata(cppscope.handle, datamember_index)
@@ -503,21 +503,21 @@
 _c_strtoll = rffi.llexternal(
     "cppyy_strtoll",
     [rffi.CCHARP], rffi.LONGLONG,
-    threadsafe=ts_helper,
+    releasegil=ts_helper,
     compilation_info=backend.eci)
 def c_strtoll(space, svalue):
     return _c_strtoll(svalue)
 _c_strtoull = rffi.llexternal(
     "cppyy_strtoull",
     [rffi.CCHARP], rffi.ULONGLONG,
-    threadsafe=ts_helper,
+    releasegil=ts_helper,
     compilation_info=backend.eci)
 def c_strtoull(space, svalue):
     return _c_strtoull(svalue)
 c_free = rffi.llexternal(
     "cppyy_free",
     [rffi.VOIDP], lltype.Void,
-    threadsafe=ts_memory,
+    releasegil=ts_memory,
     compilation_info=backend.eci)
 
 def charp2str_free(space, charp):
@@ -529,7 +529,7 @@
 _c_charp2stdstring = rffi.llexternal(
     "cppyy_charp2stdstring",
     [rffi.CCHARP], C_OBJECT,
-    threadsafe=ts_helper,
+    releasegil=ts_helper,
     compilation_info=backend.eci)
 def c_charp2stdstring(space, svalue):
     charp = rffi.str2charp(svalue)
@@ -539,14 +539,14 @@
 _c_stdstring2stdstring = rffi.llexternal(
     "cppyy_stdstring2stdstring",
     [C_OBJECT], C_OBJECT,
-    threadsafe=ts_helper,
+    releasegil=ts_helper,
     compilation_info=backend.eci)
 def c_stdstring2stdstring(space, cppobject):
     return _c_stdstring2stdstring(cppobject)
 _c_assign2stdstring = rffi.llexternal(
     "cppyy_assign2stdstring",
     [C_OBJECT, rffi.CCHARP], lltype.Void,
-    threadsafe=ts_helper,
+    releasegil=ts_helper,
     compilation_info=backend.eci)
 def c_assign2stdstring(space, cppobject, svalue):
     charp = rffi.str2charp(svalue)
@@ -555,7 +555,7 @@
 _c_free_stdstring = rffi.llexternal(
     "cppyy_free_stdstring",
     [C_OBJECT], lltype.Void,
-    threadsafe=ts_helper,
+    releasegil=ts_helper,
     compilation_info=backend.eci)
 def c_free_stdstring(space, cppobject):
     _c_free_stdstring(cppobject)
diff --git a/pypy/module/cppyy/capi/cint_capi.py b/pypy/module/cppyy/capi/cint_capi.py
--- a/pypy/module/cppyy/capi/cint_capi.py
+++ b/pypy/module/cppyy/capi/cint_capi.py
@@ -60,7 +60,7 @@
 _c_load_dictionary = rffi.llexternal(
     "cppyy_load_dictionary",
     [rffi.CCHARP], rdynload.DLLHANDLE,
-    threadsafe=False,
+    releasegil=False,
     compilation_info=eci)
 
 def c_load_dictionary(name):
@@ -84,7 +84,7 @@
 _ttree_Branch = rffi.llexternal(
     "cppyy_ttree_Branch",
     [rffi.VOIDP, rffi.CCHARP, rffi.CCHARP, rffi.VOIDP, rffi.INT, rffi.INT], rffi.LONG,
-    threadsafe=False,
+    releasegil=False,
     compilation_info=eci)
 
 @unwrap_spec(args_w='args_w')
@@ -158,7 +158,7 @@
 c_ttree_GetEntry = rffi.llexternal(
     "cppyy_ttree_GetEntry",
     [rffi.VOIDP, rffi.LONGLONG], rffi.LONGLONG,
-    threadsafe=False,
+    releasegil=False,
     compilation_info=eci)
 
 @unwrap_spec(args_w='args_w')
diff --git a/pypy/module/crypt/interp_crypt.py b/pypy/module/crypt/interp_crypt.py
--- a/pypy/module/crypt/interp_crypt.py
+++ b/pypy/module/crypt/interp_crypt.py
@@ -8,7 +8,7 @@
 else:
     eci = ExternalCompilationInfo(libraries=['crypt'])
 c_crypt = rffi.llexternal('crypt', [rffi.CCHARP, rffi.CCHARP], rffi.CCHARP,
-                          compilation_info=eci, threadsafe=False)
+                          compilation_info=eci, releasegil=False)
 
 @unwrap_spec(word=str, salt=str)
 def crypt(space, word, salt):
diff --git a/pypy/module/pyexpat/interp_pyexpat.py b/pypy/module/pyexpat/interp_pyexpat.py
--- a/pypy/module/pyexpat/interp_pyexpat.py
+++ b/pypy/module/pyexpat/interp_pyexpat.py
@@ -356,7 +356,7 @@
 XML_ParserCreateNS = expat_external(
     'XML_ParserCreateNS', [rffi.CCHARP, rffi.CHAR], XML_Parser)
 XML_ParserFree = expat_external(
-    'XML_ParserFree', [XML_Parser], lltype.Void, threadsafe=False)
+    'XML_ParserFree', [XML_Parser], lltype.Void, releasegil=False)
 XML_SetUserData = expat_external(
     'XML_SetUserData', [XML_Parser, rffi.VOIDP], lltype.Void)
 def XML_GetUserData(parser):
diff --git a/pypy/module/rctime/interp_time.py b/pypy/module/rctime/interp_time.py
--- a/pypy/module/rctime/interp_time.py
+++ b/pypy/module/rctime/interp_time.py
@@ -151,7 +151,7 @@
     return rffi.llexternal(name, args, result,
                            compilation_info=eci,
                            calling_conv=calling_conv,
-                           threadsafe=False)
+                           releasegil=False)
 
 if _POSIX:
     cConfig.timeval.__name__ = "_timeval"
diff --git a/rpython/jit/codewriter/test/test_call.py b/rpython/jit/codewriter/test/test_call.py
--- a/rpython/jit/codewriter/test/test_call.py
+++ b/rpython/jit/codewriter/test/test_call.py
@@ -181,7 +181,7 @@
     from rpython.jit.backend.llgraph.runner import LLGraphCPU
 
     T = rffi.CArrayPtr(rffi.TIME_T)
-    external = rffi.llexternal("time", [T], rffi.TIME_T, threadsafe=True)
+    external = rffi.llexternal("time", [T], rffi.TIME_T, releasegil=True)
 
     @jit.dont_look_inside
     def f():
@@ -203,7 +203,7 @@
     from rpython.jit.backend.llgraph.runner import LLGraphCPU
 
     T = rffi.CArrayPtr(rffi.TIME_T)
-    external = rffi.llexternal("time", [T], rffi.TIME_T, threadsafe=True)
+    external = rffi.llexternal("time", [T], rffi.TIME_T, releasegil=True)
 
     # no jit.dont_look_inside in this test
     def f():
diff --git a/rpython/jit/metainterp/test/test_ajit.py b/rpython/jit/metainterp/test/test_ajit.py
--- a/rpython/jit/metainterp/test/test_ajit.py
+++ b/rpython/jit/metainterp/test/test_ajit.py
@@ -3232,7 +3232,7 @@
             py.test.skip("needs 'time'")
         T = rffi.CArrayPtr(rffi.TIME_T)
 
-        external = rffi.llexternal("time", [T], rffi.TIME_T, threadsafe=True)
+        external = rffi.llexternal("time", [T], rffi.TIME_T, releasegil=True)
         # Not a real lock, has all the same properties with respect to GIL
         # release though, so good for this test.
         class Lock(object):
diff --git a/rpython/memory/gctransform/test/test_framework.py b/rpython/memory/gctransform/test/test_framework.py
--- a/rpython/memory/gctransform/test/test_framework.py
+++ b/rpython/memory/gctransform/test/test_framework.py
@@ -72,14 +72,14 @@
     assert not CollectAnalyzer(t).analyze_direct_call(gg)    
 
 def test_cancollect_external():
-    fext1 = rffi.llexternal('fext1', [], lltype.Void, threadsafe=False)
+    fext1 = rffi.llexternal('fext1', [], lltype.Void, releasegil=False)
     def g():
         fext1()
     t = rtype(g, [])
     gg = graphof(t, g)
     assert not CollectAnalyzer(t).analyze_direct_call(gg)
 
-    fext2 = rffi.llexternal('fext2', [], lltype.Void, threadsafe=True)
+    fext2 = rffi.llexternal('fext2', [], lltype.Void, releasegil=True)
     def g():
         fext2()
     t = rtype(g, [])
@@ -88,7 +88,7 @@
 
     S = lltype.GcStruct('S', ('x', lltype.Signed))
     FUNC = lltype.Ptr(lltype.FuncType([lltype.Signed], lltype.Void))
-    fext3 = rffi.llexternal('fext3', [FUNC], lltype.Void, threadsafe=False)
+    fext3 = rffi.llexternal('fext3', [FUNC], lltype.Void, releasegil=False)
     def h(x):
         lltype.malloc(S, zero=True)
     def g():
diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py
--- a/rpython/rlib/_rsocket_rffi.py
+++ b/rpython/rlib/_rsocket_rffi.py
@@ -481,9 +481,9 @@
 socket = external('socket', [rffi.INT, rffi.INT, rffi.INT], socketfd_type)
 
 if WIN32:
-    socketclose = external('closesocket', [socketfd_type], rffi.INT, threadsafe=False)
+    socketclose = external('closesocket', [socketfd_type], rffi.INT, releasegil=False)
 else:
-    socketclose = external('close', [socketfd_type], rffi.INT, threadsafe=False)
+    socketclose = external('close', [socketfd_type], rffi.INT, releasegil=False)
 
 socketconnect = external('connect', [socketfd_type, sockaddr_ptr, socklen_t], rffi.INT)
 
@@ -494,10 +494,10 @@
 getnameinfo = external('getnameinfo', [sockaddr_ptr, socklen_t, CCHARP,
                        size_t, CCHARP, size_t, rffi.INT], rffi.INT)
 
-htonl = external('htonl', [rffi.UINT], rffi.UINT, threadsafe=False)
-htons = external('htons', [rffi.USHORT], rffi.USHORT, threadsafe=False)
-ntohl = external('ntohl', [rffi.UINT], rffi.UINT, threadsafe=False)
-ntohs = external('ntohs', [rffi.USHORT], rffi.USHORT, threadsafe=False)
+htonl = external('htonl', [rffi.UINT], rffi.UINT, releasegil=False)
+htons = external('htons', [rffi.USHORT], rffi.USHORT, releasegil=False)
+ntohl = external('ntohl', [rffi.UINT], rffi.UINT, releasegil=False)
+ntohs = external('ntohs', [rffi.USHORT], rffi.USHORT, releasegil=False)
 
 if _POSIX:
     inet_aton = external('inet_aton', [CCHARP, lltype.Ptr(in_addr)],
diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py
--- a/rpython/rlib/rdynload.py
+++ b/rpython/rlib/rdynload.py
@@ -68,7 +68,7 @@
 
 if not _WIN32:
     c_dlopen = external('dlopen', [rffi.CCHARP, rffi.INT], rffi.VOIDP)
-    c_dlclose = external('dlclose', [rffi.VOIDP], rffi.INT, threadsafe=False)
+    c_dlclose = external('dlclose', [rffi.VOIDP], rffi.INT, releasegil=False)
     c_dlerror = external('dlerror', [], rffi.CCHARP)
     c_dlsym = external('dlsym', [rffi.VOIDP, rffi.CCHARP], rffi.VOIDP)
 
diff --git a/rpython/rlib/rmmap.py b/rpython/rlib/rmmap.py
--- a/rpython/rlib/rmmap.py
+++ b/rpython/rlib/rmmap.py
@@ -113,7 +113,7 @@
                              **kwargs)
     safe = rffi.llexternal(name, args, result,
                            compilation_info=CConfig._compilation_info_,
-                           sandboxsafe=True, threadsafe=False,
+                           sandboxsafe=True, releasegil=False,
                            **kwargs)
     return unsafe, safe
 
@@ -195,7 +195,7 @@
     CreateFileMapping = winexternal('CreateFileMappingA', [HANDLE, rwin32.LPSECURITY_ATTRIBUTES, DWORD, DWORD, DWORD, LPCSTR], HANDLE)
     MapViewOfFile = winexternal('MapViewOfFile', [HANDLE, DWORD, DWORD, DWORD, SIZE_T], LPCSTR)##!!LPVOID)
     UnmapViewOfFile = winexternal('UnmapViewOfFile', [LPCSTR], BOOL,
-                                  threadsafe=False)
+                                  releasegil=False)
     FlushViewOfFile = winexternal('FlushViewOfFile', [LPCSTR, SIZE_T], BOOL)
     SetFilePointer = winexternal('SetFilePointer', [HANDLE, LONG, PLONG, DWORD], DWORD)
     SetEndOfFile = winexternal('SetEndOfFile', [HANDLE], BOOL)
diff --git a/rpython/rlib/ropenssl.py b/rpython/rlib/ropenssl.py
--- a/rpython/rlib/ropenssl.py
+++ b/rpython/rlib/ropenssl.py
@@ -242,7 +242,7 @@
 ssl_external('X509_NAME_ENTRY_get_object', [X509_NAME_ENTRY], ASN1_OBJECT)
 ssl_external('X509_NAME_ENTRY_get_data', [X509_NAME_ENTRY], ASN1_STRING)
 ssl_external('i2d_X509', [X509, rffi.CCHARPP], rffi.INT)
-ssl_external('X509_free', [X509], lltype.Void, threadsafe=False)
+ssl_external('X509_free', [X509], lltype.Void, releasegil=False)
 ssl_external('X509_get_notBefore', [X509], ASN1_TIME, macro=True)
 ssl_external('X509_get_notAfter', [X509], ASN1_TIME, macro=True)
 ssl_external('X509_get_serialNumber', [X509], ASN1_INTEGER)
@@ -282,10 +282,10 @@
 ssl_external('ERR_error_string', [rffi.ULONG, rffi.CCHARP], rffi.CCHARP)
 ssl_external('ERR_clear_error', [], lltype.Void)
 
-# 'threadsafe=False' here indicates that this function will be called
+# 'releasegil=False' here indicates that this function will be called
 # with the GIL held, and so is allowed to run in a RPython __del__ method.
-ssl_external('SSL_free', [SSL], lltype.Void, threadsafe=False)
-ssl_external('SSL_CTX_free', [SSL_CTX], lltype.Void, threadsafe=False)
+ssl_external('SSL_free', [SSL], lltype.Void, releasegil=False)
+ssl_external('SSL_CTX_free', [SSL_CTX], lltype.Void, releasegil=False)
 ssl_external('CRYPTO_free', [rffi.VOIDP], lltype.Void)
 libssl_OPENSSL_free = libssl_CRYPTO_free
 
@@ -325,7 +325,7 @@
 EVP_MD_CTX_copy = external(
     'EVP_MD_CTX_copy', [EVP_MD_CTX, EVP_MD_CTX], rffi.INT)
 EVP_MD_CTX_cleanup = external(
-    'EVP_MD_CTX_cleanup', [EVP_MD_CTX], rffi.INT, threadsafe=False)
+    'EVP_MD_CTX_cleanup', [EVP_MD_CTX], rffi.INT, releasegil=False)
 
 OBJ_NAME_CALLBACK = lltype.Ptr(lltype.FuncType(
         [OBJ_NAME, rffi.VOIDP], lltype.Void))
diff --git a/rpython/rlib/rsignal.py b/rpython/rlib/rsignal.py
--- a/rpython/rlib/rsignal.py
+++ b/rpython/rlib/rsignal.py
@@ -77,11 +77,11 @@
 pypysig_setflag = external('pypysig_setflag', [rffi.INT], lltype.Void)
 pypysig_reinstall = external('pypysig_reinstall', [rffi.INT], lltype.Void)
 pypysig_set_wakeup_fd = external('pypysig_set_wakeup_fd', [rffi.INT], rffi.INT)
-pypysig_poll = external('pypysig_poll', [], rffi.INT, threadsafe=False)
+pypysig_poll = external('pypysig_poll', [], rffi.INT, releasegil=False)
 # don't bother releasing the GIL around a call to pypysig_poll: it's
 # pointless and a performance issue
 pypysig_pushback = external('pypysig_pushback', [rffi.INT], lltype.Void,
-                            threadsafe=False)
+                            releasegil=False)
 
 # don't use rffi.LONGP because the JIT doesn't support raw arrays so far
 struct_name = 'pypysig_long_struct'
@@ -93,7 +93,7 @@
                                     lltype.Ptr(LONG_STRUCT), _nowrapper=True,
                                     elidable_function=True)
 c_alarm = external('alarm', [rffi.INT], rffi.INT)
-c_pause = external('pause', [], rffi.INT, threadsafe=True)
+c_pause = external('pause', [], rffi.INT, releasegil=True)
 c_siginterrupt = external('siginterrupt', [rffi.INT, rffi.INT], rffi.INT)
 
 if sys.platform != 'win32':
diff --git a/rpython/rlib/rthread.py b/rpython/rlib/rthread.py
--- a/rpython/rlib/rthread.py
+++ b/rpython/rlib/rthread.py
@@ -44,7 +44,7 @@
 CALLBACK = lltype.Ptr(lltype.FuncType([], lltype.Void))
 c_thread_start = llexternal('RPyThreadStart', [CALLBACK], rffi.LONG,
                             _callable=_emulated_start_new_thread,
-                            threadsafe=True)  # release the GIL, but most
+                            releasegil=True)  # release the GIL, but most
                                               # importantly, reacquire it
                                               # around the callback
 c_thread_get_ident = llexternal('RPyThreadGetIdent', [], rffi.LONG,
@@ -54,19 +54,19 @@
                           compilation_info=eci)
 TLOCKP_SIZE = rffi_platform.sizeof('struct RPyOpaque_ThreadLock', eci)
 c_thread_lock_init = llexternal('RPyThreadLockInit', [TLOCKP], rffi.INT,
-                                threadsafe=False)   # may add in a global list
+                                releasegil=False)   # may add in a global list
 c_thread_lock_dealloc_NOAUTO = llexternal('RPyOpaqueDealloc_ThreadLock',
                                           [TLOCKP], lltype.Void,
                                           _nowrapper=True)
 c_thread_acquirelock = llexternal('RPyThreadAcquireLock', [TLOCKP, rffi.INT],
                                   rffi.INT,
-                                  threadsafe=True)    # release the GIL
+                                  releasegil=True)    # release the GIL
 c_thread_acquirelock_timed = llexternal('RPyThreadAcquireLockTimed', 
                                         [TLOCKP, rffi.LONGLONG, rffi.INT],
                                         rffi.INT,
-                                        threadsafe=True)    # release the GIL
+                                        releasegil=True)    # release the GIL
 c_thread_releaselock = llexternal('RPyThreadReleaseLock', [TLOCKP], lltype.Void,
-                                  threadsafe=True)    # release the GIL
+                                  releasegil=True)    # release the GIL
 
 # another set of functions, this time in versions that don't cause the
 # GIL to be released.  To use to handle the GIL lock itself.
diff --git a/rpython/rlib/rwin32.py b/rpython/rlib/rwin32.py
--- a/rpython/rlib/rwin32.py
+++ b/rpython/rlib/rwin32.py
@@ -118,7 +118,7 @@
     INVALID_HANDLE_VALUE = rffi.cast(HANDLE, -1)
     PFILETIME = rffi.CArrayPtr(FILETIME)
 
-    _GetLastError = winexternal('GetLastError', [], DWORD, threadsafe=False)
+    _GetLastError = winexternal('GetLastError', [], DWORD, releasegil=False)
     _SetLastError = winexternal('SetLastError', [DWORD], lltype.Void)
 
     def GetLastError():
@@ -134,10 +134,10 @@
     GetProcAddress = winexternal('GetProcAddress',
                                  [HMODULE, rffi.CCHARP],
                                  rffi.VOIDP)
-    FreeLibrary = winexternal('FreeLibrary', [HMODULE], BOOL, threadsafe=False)
+    FreeLibrary = winexternal('FreeLibrary', [HMODULE], BOOL, releasegil=False)
 
     LocalFree = winexternal('LocalFree', [HLOCAL], DWORD)
-    CloseHandle = winexternal('CloseHandle', [HANDLE], BOOL, threadsafe=False)
+    CloseHandle = winexternal('CloseHandle', [HANDLE], BOOL, releasegil=False)
 
     FormatMessage = winexternal(
         'FormatMessageA',
diff --git a/rpython/rlib/rzlib.py b/rpython/rlib/rzlib.py
--- a/rpython/rlib/rzlib.py
+++ b/rpython/rlib/rzlib.py
@@ -134,7 +134,7 @@
 _deflate = zlib_external('deflate', [z_stream_p, rffi.INT], rffi.INT)
 
 _deflateEnd = zlib_external('deflateEnd', [z_stream_p], rffi.INT,
-                            threadsafe=False)
+                            releasegil=False)
 
 def _deflateInit2(stream, level, method, wbits, memlevel, strategy):
     size = rffi.sizeof(z_stream)
@@ -153,7 +153,7 @@
 _inflate = zlib_external('inflate', [z_stream_p, rffi.INT], rffi.INT)
 
 _inflateEnd = zlib_external('inflateEnd', [z_stream_p], rffi.INT,
-                            threadsafe=False)
+                            releasegil=False)
 
 def _inflateInit2(stream, wbits):
     size = rffi.sizeof(z_stream)
diff --git a/rpython/rtyper/lltypesystem/rffi.py b/rpython/rtyper/lltypesystem/rffi.py
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -60,7 +60,7 @@
 
 def llexternal(name, args, result, _callable=None,
                compilation_info=ExternalCompilationInfo(),
-               sandboxsafe=False, threadsafe='auto',
+               sandboxsafe=False, releasegil='auto',
                _nowrapper=False, calling_conv='c',
                elidable_function=False, macro=None,
                random_effects_on_gcobjs='auto'):
@@ -77,7 +77,7 @@
     as constant RPython functions.  We don't support yet C functions that
     invoke callbacks passed otherwise (e.g. set by a previous C call).
 
-    threadsafe: whether it's ok to release the GIL around the call.
+    releasegil: whether it's ok to release the GIL around the call.
                 Default is yes, unless sandboxsafe is set, in which case
                 we consider that the function is really short-running and
                 don't bother releasing the GIL.  An explicit True or False
@@ -107,10 +107,10 @@
     else:
         callbackholder = None
 
-    if threadsafe in (False, True):
+    if releasegil in (False, True):
         # invoke the around-handlers, which release the GIL, if and only if
         # the C function is thread-safe.
-        invoke_around_handlers = threadsafe
+        invoke_around_handlers = releasegil
     else:
         # default case:
         # invoke the around-handlers only for "not too small" external calls;
@@ -1132,11 +1132,3 @@
         keep_unicodebuffer_alive_until_here(self.raw, self.gc_buf)
     def str(self, length):
         return unicode_from_buffer(self.raw, self.gc_buf, self.size, length)
-
-# You would have to have a *huge* amount of data for this to block long enough
-# to be worth it to release the GIL.
-c_memcpy = llexternal("memcpy",
-    [VOIDP, VOIDP, SIZE_T],
-    lltype.Void,
-    threadsafe=False
-)
diff --git a/rpython/rtyper/module/ll_os.py b/rpython/rtyper/module/ll_os.py
--- a/rpython/rtyper/module/ll_os.py
+++ b/rpython/rtyper/module/ll_os.py
@@ -379,7 +379,7 @@
 
     @registering_if(os, "getlogin", condition=not _WIN32)
     def register_os_getlogin(self):
-        os_getlogin = self.llexternal('getlogin', [], rffi.CCHARP, threadsafe=False)
+        os_getlogin = self.llexternal('getlogin', [], rffi.CCHARP, releasegil=False)
 
         def getlogin_llimpl():
             result = os_getlogin()
@@ -681,7 +681,7 @@
 
     @registering_if(os, 'getpid')
     def register_os_getpid(self):
-        return self.extdef_for_os_function_returning_int('getpid', threadsafe=False)
+        return self.extdef_for_os_function_returning_int('getpid', releasegil=False)
 
     @registering_if(os, 'getgid')
     def register_os_getgid(self):
@@ -882,7 +882,7 @@
     @registering(os.close)
     def register_os_close(self):
         os_close = self.llexternal(underscore_on_windows+'close', [rffi.INT],
-                                   rffi.INT, threadsafe=False)
+                                   rffi.INT, releasegil=False)
 
         def close_llimpl(fd):
             rposix.validate_fd(fd)
@@ -1323,7 +1323,7 @@
 
     @registering(os.strerror)
     def register_os_strerror(self):
-        os_strerror = self.llexternal('strerror', [rffi.INT], rffi.CCHARP, threadsafe=False)
+        os_strerror = self.llexternal('strerror', [rffi.INT], rffi.CCHARP, releasegil=False)
 
         def strerror_llimpl(errnum):
             res = os_strerror(rffi.cast(rffi.INT, errnum))
@@ -1738,7 +1738,7 @@
 
     @registering_if(os, 'ttyname')
     def register_os_ttyname(self):
-        os_ttyname = self.llexternal('ttyname', [lltype.Signed], rffi.CCHARP, threadsafe=False)
+        os_ttyname = self.llexternal('ttyname', [lltype.Signed], rffi.CCHARP, releasegil=False)
 
         def ttyname_llimpl(fd):
             l_name = os_ttyname(fd)
diff --git a/rpython/rtyper/module/ll_os_environ.py b/rpython/rtyper/module/ll_os_environ.py
--- a/rpython/rtyper/module/ll_os_environ.py
+++ b/rpython/rtyper/module/ll_os_environ.py
@@ -116,11 +116,11 @@
     just_a_placeholder
 
 os_getenv = rffi.llexternal('getenv', [rffi.CCHARP], rffi.CCHARP,
-                            threadsafe=False)
+                            releasegil=False)
 os_putenv = rffi.llexternal('putenv', [rffi.CCHARP], rffi.INT)
 if _WIN32:
     _wgetenv = rffi.llexternal('_wgetenv', [rffi.CWCHARP], rffi.CWCHARP,
-                               compilation_info=eci, threadsafe=False)
+                               compilation_info=eci, releasegil=False)
     _wputenv = rffi.llexternal('_wputenv', [rffi.CWCHARP], rffi.INT,
                                compilation_info=eci)
 
diff --git a/rpython/rtyper/module/ll_time.py b/rpython/rtyper/module/ll_time.py
--- a/rpython/rtyper/module/ll_time.py
+++ b/rpython/rtyper/module/ll_time.py
@@ -81,11 +81,11 @@
             if self.GETTIMEOFDAY_NO_TZ:
                 c_gettimeofday = self.llexternal('gettimeofday',
                                  [self.TIMEVALP], rffi.INT,
-                                  _nowrapper=True, threadsafe=False)
+                                  _nowrapper=True, releasegil=False)
             else:
                 c_gettimeofday = self.llexternal('gettimeofday',
                                  [self.TIMEVALP, rffi.VOIDP], rffi.INT,
-                                  _nowrapper=True, threadsafe=False)
+                                  _nowrapper=True, releasegil=False)
         else:
             c_gettimeofday = None
 
@@ -93,12 +93,12 @@
             self.configure(CConfigForFTime)
             c_ftime = self.llexternal(FTIME, [lltype.Ptr(self.TIMEB)],
                                       lltype.Void,
-                                      _nowrapper=True, threadsafe=False)
+                                      _nowrapper=True, releasegil=False)
         else:
             c_ftime = None    # to not confuse the flow space
 
         c_time = self.llexternal('time', [rffi.VOIDP], rffi.TIME_T,
-                                 _nowrapper=True, threadsafe=False)
+                                 _nowrapper=True, releasegil=False)
 
         def time_time_llimpl():
             void = lltype.nullptr(rffi.VOIDP.TO)
@@ -136,10 +136,10 @@
             A = lltype.FixedSizeArray(lltype.SignedLongLong, 1)
             QueryPerformanceCounter = self.llexternal(
                 'QueryPerformanceCounter', [lltype.Ptr(A)], lltype.Void,
-                threadsafe=False)
+                releasegil=False)
             QueryPerformanceFrequency = self.llexternal(
                 'QueryPerformanceFrequency', [lltype.Ptr(A)], rffi.INT,
-                threadsafe=False)
+                releasegil=False)
             class State(object):
                 pass
             state = State()
@@ -162,7 +162,7 @@
             c_getrusage = self.llexternal('getrusage', 
                                           [rffi.INT, lltype.Ptr(RUSAGE)],
                                           lltype.Void,
-                                          threadsafe=False)
+                                          releasegil=False)
             def time_clock_llimpl():
                 a = lltype.malloc(RUSAGE, flavor='raw')
                 c_getrusage(RUSAGE_SELF, a)
diff --git a/rpython/translator/backendopt/test/test_gilanalysis.py b/rpython/translator/backendopt/test/test_gilanalysis.py
--- a/rpython/translator/backendopt/test/test_gilanalysis.py
+++ b/rpython/translator/backendopt/test/test_gilanalysis.py
@@ -7,16 +7,16 @@
 from rpython.translator.translator import graphof
 
 def test_canrelease_external():
-    for ths in ['auto', True, False]:
+    for rel in ['auto', True, False]:
         for sbxs in [True, False]:
             fext = rffi.llexternal('fext2', [], lltype.Void, 
-                                   threadsafe=ths, sandboxsafe=sbxs)
+                                   releasegil=rel, sandboxsafe=sbxs)
             def g():
                 fext()
             t = rtype(g, [])
             gg = graphof(t, g)
 
-            releases = (ths == 'auto' and not sbxs) or ths is True
+            releases = (rel == 'auto' and not sbxs) or rel is True
             assert releases == gilanalysis.GilAnalyzer(t).analyze_direct_call(gg)
 
 def test_canrelease_instantiate():
@@ -58,7 +58,7 @@
 def test_no_release_gil_detect(gc="minimark"):
     from rpython.rlib import rgc
 
-    fext1 = rffi.llexternal('fext1', [], lltype.Void, threadsafe=True)
+    fext1 = rffi.llexternal('fext1', [], lltype.Void, releasegil=True)
     @rgc.no_release_gil
     def g():
         fext1()
@@ -74,7 +74,3 @@
     f = py.test.raises(Exception, gilanalysis.analyze, t.graphs, t)
     expected = "'no_release_gil' function can release the GIL: <function g at "
     assert str(f.value).startswith(expected)
-
-
-
-


More information about the pypy-commit mailing list