¡@

Home 

2014/10/16 ¤W¤È 08:21:22

android Programming Glossary: pauseablethread

More efficient way for pausing loop wanted

http://stackoverflow.com/questions/10665780/more-efficient-way-for-pausing-loop-wanted

if you wish. import java.util.concurrent.locks.ReadWriteLock import java.util.concurrent.locks.ReentrantReadWriteLock PauseableThread is a Thread with pause resume and cancel methods. The meat of the process must implement `step`. You can either extend this.. Note that I cannot extend Thread because my resume will clash with Thread's deprecated one. public abstract class PauseableThread implements Runnable The lock. We'll hold a read lock on it to pause the thread. The thread will momentarily grab a write.. thrown exception stops the whole process. public abstract void step throws Exception Factory to wrap a Stepper in a PauseableThread public static PauseableThread make Stepper stepper StepperThread pauseableStepper new StepperThread stepper That's the thread..