My project uses eventlet
and now I have to asynchronously read and write to a file(a device, actually). I tried eventlet.tpool.execute()
to run the reading thread, but it blocks the main loop.
My question is, how to run the reading thread concurrently with the eventlet thread? Is it possible for these two threads to communicate in some ways?
A quick sketch:
def functionB():
while True:
data = readFile()
doSomethingWith(data)
def functionA():
doSomething()
tpool.execute(functionB)
doSomethingElse()
Then doSomethingElse()
is never called.