Share Work Queue

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Share Work Queue

ray malone
I would like to build a process that runs in a seperate thread from CherryPy but receives messages via a shared Queue.  

Something Like:

# Start new Threads
        thread1.start() ## Worker One
        thread2.start() ## Worker 2
        
        
        cherrypy.tree.mount(HelloWorld(), '/')
        cherrypy.engine.start()
        cherrypy.engine.block()


Inside of HellowWorld() I would like to be able to access a shared Queue between all of the Threads 1,2, and CherryPy.


Thanks

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Share Work Queue

Andrew Maizels
You can use the Python Queue module for that - it's designed to work transparently across multiple threads.

On Sun, Mar 27, 2016 at 10:31 AM, ray malone <[hidden email]> wrote:
I would like to build a process that runs in a seperate thread from CherryPy but receives messages via a shared Queue.  

Something Like:

# Start new Threads
        thread1.start() ## Worker One
        thread2.start() ## Worker 2
        
        
        cherrypy.tree.mount(HelloWorld(), '/')
        cherrypy.engine.start()
        cherrypy.engine.block()


Inside of HellowWorld() I would like to be able to access a shared Queue between all of the Threads 1,2, and CherryPy.


Thanks

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.



--
Ahh... We are all heroes; you and Boo and I.
Hamsters and rangers everywhere, rejoice!
Read Peopleware! http://www.amazon.com/Peopleware-Productive-Projects-Teams-Second/dp/0932633439

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.