thread example in scratch.c