You code above has the added disadvantage of possibly printing some values twice while skipping a value later on.
Wise synchronization of threads will usually involve either queues or semaphores. Feel free to look into Thread::Queue or Thread::Semaphore for implementation details.
In reply to Re^7: Threading in a loop
by Anonymous Monk
in thread Threading in a loop
by jerre_111
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |