Hello, I have coded an IRC bot in Python. Each inbound packet is parsed, and once the bot decides whether it is a command directed at the bot or not, it will either discard the packet or make a function call to an access control checker function. If the invoking user is found to have sufficient access to run this command, another function call is made. This function call depends on what command the user in question has invoked.
Try to imagine making one of these functions send out a WHOIS query to the server, and wait for the burst of WHOIS-response packets from it. How would this function wait? Yes, I know, I am going to have to create another thread to loop while it waits for this reply packet. The problem is, I can't simply tell my command function to loop until the "waiter thread" raises a flag to say that it has received the packet. During this looping time, program flow would be stuck here, thus preventing the bot from replying to any vital duties such as "pingponging" (server verifies that you are still there by sending "PING" and expects a "PONG" in return.) For this reason I was thinking: do you think I should run a new thread whenever a new command is invoked by a user? And have the thread delete itself when it's completed execution? This way the bot would *always* be free to do its duties. Any help is much appreciated. M. Baker -- http://mail.python.org/mailman/listinfo/python-list