Commit ebd34dcc authored by gsamain's avatar gsamain Committed by Xavier Thompson

Reflect changes in nogil_extension test

parent 9cabf048
......@@ -32,7 +32,7 @@ from libc.stdio cimport printf
# cdef class SomeMemory:
ccdef class SomeMemory:
cdef cypclass SomeMemory:
"""
This is a cdef class which is also called
a extensino type. It is a kind of C struct
......@@ -46,30 +46,29 @@ ccdef class SomeMemory:
where all methods are "nogil" and memory
allocation does not depend on python runtime
"""
cdef int a;
cdef double b;
int a;
double b;
cdef void cinit(self, a, b) nogil:
# self.a = a
# self.b = b
pass
void __init__(int a, double b):
this.a = a
this.b = b
cdef void cdealloc(self):
void __dealloc__():
pass
cdef void foo1(self):
void foo1():
"""
It is possible to define native C/Cython methods
that release the GIL (cool...)
"""
self.a += 3
this.a += 3
cdef void foo2(self) nogil:
void foo2():
"""
It is possible to define native C/Cython methods
that release the GIL (cool...)
"""
self.a = 42
this.a = 42
# Not allowed to define pure Python function in the extension type with nogil option now
# since we want this extension type is CPython free
......
......@@ -6,7 +6,9 @@ setup(
ext_modules = cythonize([
Extension(
'nogil_extension',
['nogil_extension.pyx'],
language='c++',
sources=['nogil_extension.pyx'],
extra_compile_args=["-pthread", "-std=c++11"],
),
])
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment