Add example of using RAII for thread waiting

Example show how to use RAII to safely wait for thread finishing. It
allows to send local variables into thread by reference and not use it
after its destroying.