Multi-threading - Token Bucket Emulation in C