Multithreaded COM server problem...

Michel Claveau/Hamster No.Spam.mc at No.Spam.mclaveau.No.Spam.com
Sat Jan 10 15:20:34 EST 2004


Hi !


 * Sorry for my bad english : french is very more easy, and nice ;-)    *

I have try another way. I use a procedure for manage thread :

GlobalTacheID=[None]*16

def tache(ordre, numtache=1, nomtache=None, fonction=None):
    global GlobalTacheID
    import threading
    if ordre=="Lance":
        GlobalTacheID[numtache] =
threading.Thread(target=fonction,name=nomtache)
        GlobalTacheID[numtache].start()
        print(nomtache+' num.'+str(numtache))
    elif ordre=="Liste":
        return(string.join(threading.enumerate(),'\n'))
    elif ordre=="Etat":
        return(str(GlobalTacheID[numtache].isAlive()))

And, in my public_method, i call this procedure, with the parameters
"ordre=Lance" for run a thread, "ordre=Etat" for see his state (fonction=
the name of the method 'threaded').

And it's OK. I can run a thread from an Excel-COM-client. I can also run an
thread on a method caontained in a string gived by Excel.

Python is very smart-dynamic-agile language.

Bonne soirée
--
Michel Claveau
mél : http://cerbermail.com/?6J1TthIa8B
site : http://mclaveau.com





More information about the Python-list mailing list