1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
import time
import threading
from Pyro5.api import expose, oneway, behavior, serve
@expose
@behavior("single")
class Server(object):
def __init__(self):
self.counter = 0
@oneway
def increment_oneway(self):
print("oneway call executing in thread", threading.get_ident())
time.sleep(0.5)
self.counter += 1
def increment(self):
time.sleep(0.5)
self.counter += 1
def getcount(self):
return self.counter
print("main thread:", threading.get_ident())
serve({
Server: "example.oneway2"
})
|