Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing Two queue's one by one  RSS feed

 
S Babs
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to run a "Starter class" which will start two threads. These threads start filling the data continously in their own queue objects.
When Starter is triggered, it should be able to pick one of the queue (by reference), by stopping one thread (while other is running) and give the pointer reference of this queue to some other object.
Next Empty this queue and this queue is ready back to get filled by the "Thread".
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First things first. When pluralizing a word, such as queue, it is not necessary to use an apostrophe. Yes, listening to my grammar pedantry is the price of my answering your question.
Sadly, my answer to your actual question may be somewhat impaired by the fact that I don't find the question completely coherent. I can glean that you have a thread that is filling a queue, and you may want to pause that thread. Here's how I would do it:

Is that what you were looking for? Does it make sense? It may be a bit overly complex with the two flags, but I worry about race conditions. Let us know if you have further questions!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!