diff options
Diffstat (limited to 'Demo')
-rw-r--r-- | Demo/metaclasses/Synch.py | 2 | ||||
-rwxr-xr-x | Demo/pysvr/pysvr.py | 8 | ||||
-rw-r--r-- | Demo/threads/Coroutine.py | 2 | ||||
-rw-r--r-- | Demo/threads/Generator.py | 2 | ||||
-rw-r--r-- | Demo/threads/find.py | 2 | ||||
-rw-r--r-- | Demo/threads/sync.py | 2 | ||||
-rw-r--r-- | Demo/threads/telnet.py | 2 |
7 files changed, 10 insertions, 10 deletions
diff --git a/Demo/metaclasses/Synch.py b/Demo/metaclasses/Synch.py index 445ce83..e02f88f 100644 --- a/Demo/metaclasses/Synch.py +++ b/Demo/metaclasses/Synch.py @@ -4,7 +4,7 @@ This metaclass makes it possible to declare synchronized methods. """ -import thread +import _thread as thread # First we need to define a reentrant lock. # This is generally useful and should probably be in a standard Python diff --git a/Demo/pysvr/pysvr.py b/Demo/pysvr/pysvr.py index b200fad..3e94dbe 100755 --- a/Demo/pysvr/pysvr.py +++ b/Demo/pysvr/pysvr.py @@ -12,7 +12,7 @@ can log in on your machine. Use with caution! """ -import sys, os, string, getopt, thread, socket, traceback +import sys, os, string, getopt, _thread, socket, traceback PORT = 4000 # Default port @@ -52,17 +52,17 @@ def main_thread(port): conn.close() print("Refusing connection from non-local host", addr[0], ".") continue - thread.start_new_thread(service_thread, (conn, addr)) + _thread.start_new_thread(service_thread, (conn, addr)) del conn, addr def service_thread(conn, addr): (caddr, cport) = addr - print("Thread %s has connection from %s.\n" % (str(thread.get_ident()), + print("Thread %s has connection from %s.\n" % (str(_thread.get_ident()), caddr), end=' ') stdin = conn.makefile("r") stdout = conn.makefile("w", 0) run_interpreter(stdin, stdout) - print("Thread %s is done.\n" % str(thread.get_ident()), end=' ') + print("Thread %s is done.\n" % str(_thread.get_ident()), end=' ') def run_interpreter(stdin, stdout): globals = {} diff --git a/Demo/threads/Coroutine.py b/Demo/threads/Coroutine.py index 4a155f8..e7d882d 100644 --- a/Demo/threads/Coroutine.py +++ b/Demo/threads/Coroutine.py @@ -66,7 +66,7 @@ # current implementation consumes a thread for each coroutine that # may be resumed. -import thread +import _thread as thread import sync class _CoEvent: diff --git a/Demo/threads/Generator.py b/Demo/threads/Generator.py index 0cc1bda..38c0c8a 100644 --- a/Demo/threads/Generator.py +++ b/Demo/threads/Generator.py @@ -1,6 +1,6 @@ # Generator implementation using threads -import thread +import _thread as thread Killed = 'Generator.Killed' diff --git a/Demo/threads/find.py b/Demo/threads/find.py index 57fe81e..2b4ef7d 100644 --- a/Demo/threads/find.py +++ b/Demo/threads/find.py @@ -20,7 +20,7 @@ import getopt import time import os from stat import * -import thread +import _thread as thread # Work queue class. Usage: diff --git a/Demo/threads/sync.py b/Demo/threads/sync.py index 61e1628..90fff2e 100644 --- a/Demo/threads/sync.py +++ b/Demo/threads/sync.py @@ -268,7 +268,7 @@ # if there are are no threads waiting to write. (This is a # weakness of the interface!) -import thread +import _thread as thread class condition: def __init__(self, lock=None): diff --git a/Demo/threads/telnet.py b/Demo/threads/telnet.py index 7366341..dfe4905 100644 --- a/Demo/threads/telnet.py +++ b/Demo/threads/telnet.py @@ -15,7 +15,7 @@ import sys, os, time from socket import * -import thread +import _thread as thread BUFSIZE = 8*1024 |