add When to use pthread_cancel and not pthread_kill
add select limit for mysql