multithreading - Mutex in Python Twisted -


I am using the twisted framework, and getting the RPC asynchronously, I have another task which Works in 2 seconds, and sleeps in the middle, it is called through the reactor. It depends on shared resources, so I need some thread-safe way to reach them. How does the use of an important sections / mutex / locks go into twists?

Although you can use thread in twisted, always with twisted RPC To do parallel using the thread is to do. One of your advantages will run a twisted framework reactor and your handler will call the event when RPC results are ready for you. Then your code runs, and when your handler turns out, the control goes back to the reactor, which will prepare the code to the next handler. So even though a lot of things are going on in parallel, turn turns to make sure that one of your functions is running only at one time, so you should not need any mutes, just keep the state variable so that your callback It can be ascertained that the current context is sufficient in the operating.

If you explicitly create threads and use them with twisted frameworks, then you probably need something like that, though you are waiting for your main reactor callback thread at any length to mute x Because the callback block inside the reactor is not there.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -