An example using pthread library.