dimanche 28 décembre 2014

synchronized block not working?

[unable to retrieve full-text content]

I'm a beginner programmer of Java and I've been playing around with threads and concurrency. I'm using Processing to create tower defense game (that's where the drawing methods come from).


In the program, there are multiple threads, which can access the fill() and stroke() methods, which change the color of the stroke and fill for the whole program. Therefore, to prevent interleaving of the colors, I put in multiple synchronized blocks in my code with the same lock, such as:






synchronized block not working?

Aucun commentaire:

Enregistrer un commentaire