Commit 5c3982ac authored by gsamain's avatar gsamain

Nogil tests with ccdef

parent 1a4e2c22
......@@ -32,7 +32,7 @@ from libc.stdio cimport printf
# cdef class SomeMemory:
cdef class SomeMemory nogil:
ccdef class SomeMemory:
"""
This is a cdef class which is also called
a extensino type. It is a kind of C struct
......@@ -41,7 +41,7 @@ cdef class SomeMemory nogil:
We would like to be able to define "nogil"
extension types:
cdef class SomeMemory nogil:
ccdef class SomeMemory:
where all methods are "nogil" and memory
allocation does not depend on python runtime
......@@ -49,22 +49,22 @@ cdef class SomeMemory nogil:
cdef int a;
cdef double b;
cdef void cinit(self, a, b) nogil:
ccdef void cinit(self, a, b):
# self.a = a
# self.b = b
pass
cdef void cdealloc(self) nogil:
ccdef void cdealloc(self):
pass
cdef void foo1(self) nogil:
ccdef void foo1(self):
"""
It is possible to define native C/Cython methods
that release the GIL (cool...)
"""
self.a += 3
cdef void foo2(self) nogil:
ccdef void foo2(self):
"""
It is possible to define native C/Cython methods
that release the GIL (cool...)
......@@ -82,7 +82,7 @@ cdef class SomeMemory nogil:
# cdef bar(): # it is currently impossible to release GIL
cdef double bar1() nogil: # yet this is what we would like to
ccdef double bar1(): # yet this is what we would like to
"""
This is a pure "cython method" which we would like to
be able to declare with nogil option but this requires
......@@ -94,7 +94,7 @@ cdef double bar1() nogil: # yet this is what we would like to
return o1.a
cdef double bar2() nogil: # yet this is what we would like to
ccdef double bar2(): # yet this is what we would like to
cdef SomeMemory o2 = SomeMemory(2, 2.0)
o2.foo2()
......
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