Sunday, October 2, 2011

Synchronization

Problem: Multiple filters can modify an image at the same time, causing image corruption.
Solution: Wrap the call to the filter method in a synchronized block based on the layer's intrinsic lock. This ensures that only one thread can modify the layer's image at any given time.


The result of invoking the Invert filter multiple times in rapid succession on a large image

Original image from HubbleSite
Copyright: Public Domain (NASA and ESA)

No comments:

Post a Comment