Commit 3c9a6a6c authored by Boxiang Sun's avatar Boxiang Sun

Sleep 1 second after finish the work in each thread

parent 5e4bb136
from lwan_coro cimport scheduler_t, scheduler_init, scheduler_coro_add, scheduler_run, scheduler_destroy, coro_yield_value, coro_yield, coro_t from lwan_coro cimport scheduler_t, scheduler_init, scheduler_coro_add, scheduler_run, scheduler_destroy, coro_yield_value, coro_yield, coro_t
from libc.stdio cimport printf from libc.stdio cimport printf
cdef extern from "unistd.h" nogil:
unsigned int sleep(unsigned int seconds)
cdef class SomeMemory nogil: cdef class SomeMemory nogil:
cdef int a; cdef int a;
cdef int b; cdef int b;
...@@ -8,6 +11,7 @@ cdef class SomeMemory nogil: ...@@ -8,6 +11,7 @@ cdef class SomeMemory nogil:
while self.a < 4: while self.a < 4:
self.a += 1 self.a += 1
printf("%d\n", self.a) printf("%d\n", self.a)
sleep(1)
def main(): def main():
cdef: cdef:
......
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