Showing posts with label queues. Show all posts
Showing posts with label queues. Show all posts

Sunday, 30 October 2011

Java: MultiThreading Example 2: A Shared Queue

In response to one of the comments: Yes. I was either going to go to html after we were done with making a simple game or 2, or to python. Python really should have been done first, its a much nicer language, but...I didn't! So there.

Back to another Java example, until this whole multithreading thing is understood properly, I looked at the dumbass book again, but I found something that looked plausible: A shared queue. I mentioned this when going over potential difficulties you may encounter without synchronizing, so this seems like a great way to learn how to make something thread-safe. On top of that, there'll be flipping between threads, unlike the clock program!