Python threads with suncc (Forte 6.1) compiler

Albert Chin-A-Young china at foo.com
Fri Aug 3 02:16:21 EDT 2001


Pataki G?bor <gabor.pataki at eth.ericsson.se> wrote:
> I would like to get some help because I am in trouble with threads. I
> work on a Solaris 8.0 (64 bit) system. Python is compiled with Sun CC
> (Forte 6.1) compiler with threading support. A small program 
> telnetting to a computer often dumps core it works fine with gcc.

Works fine for me on a Solaris 8/SPARC machine running a 64-bit
kernel. I tried Python 2.0.1 and 2.1.1 both compiled with Sun Forte
6.1.

$ ./test.py
ThreadID 0 started
ThreadID 1 started
ThreadID 2 started
ThreadID 3 started
ThreadID 2 finished
ThreadID 3 finished
ThreadID 1 finished
ThreadID 0 finished

> Thanks,
> Gabor Pataki

> import threading
> import telnetlib

> def TelnetToIpw01():
>    
>        hostname = "my_hostname"
>        username = "user_name"
>        password = "password"
>        
>        tn = telnetlib.Telnet(hostname)
>        tn.read_until("login: ")
>        tn.write(username + '\n')
>        tn.read_until("Password: ")
>        tn.write(password + '\n')

> class MyThread(threading.Thread):
>        
>        def run(self):
>                print "ThreadID", self.cnt, "started"
>                TelnetToIpw01()
>                print "ThreadID", self.cnt, "finished"

> for i in range(0,4):
>        m = MyThread()
>        m.cnt = i
>        m.start()

-- 
albert chin (china at thewrittenword dot com)



More information about the Python-list mailing list