multi-threading and mysql programming