Token Bucket Emulation in C using Multithreading