Operation will block forever error

73 views
Skip to first unread message

jsia

unread,
Apr 10, 2014, 8:37:08 PM4/10/14
to gev...@googlegroups.com
Hi,

I'm binding hiredis async library with gevent.  I already done it for the old gevent + libevent.  Im trying to bind it to the new gevent + libev.  However, Im stuck and getting operation will block forever error on AsyncResult whenever I try to execute the .get method.  I used cython btw.

Below is sample code of what I'm doing

cdef void __cmdCallabck(redisAsyncContext_ptr2 ac, void *r, void *pd) with gil:
    cdef object callback = <object>pd
    callback.set("aaaaaa")

def execute():
     cdef object asyncres = AsyncResult()
     redisAsyncCommand(ctx, __cmdCallback, <void*>asyncres, "GET key")
     cdef  object result = asyncres.get()


def start():
     cdef char *address
     cdef int port
     cdef unsigned int flags = 0
 
      address = "10.11.3.125"
      port = 6379
      ctx = <redisAsyncContext *> redisAsyncConnect(address, port, <void *> NULL)
      _ptr = gevent_ev_default_loop(0)
      redisLibevAttach(ctx, _ptr)
   
     with nogil:
         flags |= EVRUN_NOWAIT
         flags |= EVRUN_ONCE
         ev_run(_ptr, flags)

I'm stuck at asyncres.get().  Anyone has any idea on why this is happening.

Thanks,
Jason
Reply all
Reply to author
Forward
0 new messages