[Tutor] Re: Tutor digest, Vol 1 #2622 - 13 msgs

G Kiran goki75@vsnl.net
Thu Jul 31 21:37:19 2003


Hi,

    I am trying to limit no of threads i can spawn for a multi threaded
socket server .

presently i do this by the following fragment of code


maxthreads=40
for ct in range(0,len(scanlist)-1):
        th.append(checkport(scanlist[ct])
        th[ct].start()
        while  threading.activeCount() > maxthreads :  pass  ##### this is
how i am limiting the no of threads

i am using the threading class fo my checkport function

is there any other way of doing it...rather than the endless loop which i
feel wastes the processor time


-kiran