本文整理汇总了Python中stackless.channel函数的典型用法代码示例。如果您正苦于以下问题:Python channel函数的具体用法?Python channel怎么用?Python channel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了channel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, value, num, boardchannel):
self.value = value
self.channel = stackless.channel()
self.instchannel = stackless.channel()
self.num = num
self.boardchannel = boardchannel
self.neighbors = []
示例2: __init__
def __init__(self, f, t, p ):
self.sock = _realsocket_old(f, t, p)
self.read_buffer_len = c_ulong( 64 )
self.read_buffer = create_string_buffer(self.read_buffer_len.value)
self.write_buffer = create_string_buffer(self.read_buffer_len.value)
self.read_ch = SL.channel()
self.write_ch = SL.channel()
self.is_server = False
self.bind_addr=("",0)
self.send_len = c_ulong()
self.recv_len = c_ulong()
self.readol = OVERLAPPED()
self.writeol = OVERLAPPED()
self.init_readol()
self.init_writeol()
self.connected = False
self.wasConnected = False
self.server_addr = None
self.recv_wsabuf = WSABUF()
self.send_wsabuf = WSABUF()
示例3: test_nested_pipe
def test_nested_pipe(self):
dprint('tnp ==== 1')
def pipe(X, Y):
dprint('tnp_P ==== 1')
foo = X.receive()
dprint('tnp_P ==== 2')
Y.send(foo)
dprint('tnp_P ==== 3')
def nest(X, Y):
X2, Y2 = stackless.channel(), stackless.channel()
t = stackless.tasklet(pipe)(X2, Y2)
dprint('tnp_N ==== 1')
X_Val = X.receive()
dprint('tnp_N ==== 2')
X2.send(X_Val)
dprint('tnp_N ==== 3')
Y2_Val = Y2.receive()
dprint('tnp_N ==== 4')
Y.send(Y2_Val)
dprint('tnp_N ==== 5')
X, Y = stackless.channel(), stackless.channel()
t1 = stackless.tasklet(nest)(X, Y)
X.send(13)
dprint('tnp ==== 2')
res = Y.receive()
dprint('tnp ==== 3')
assert res == 13
if SHOW_STRANGE:
raise Exception('force prints')
示例4: Create
def Create(cls, *args, **kwargs):
self = cls.__new__(cls, *args, **kwargs)
self.__processingChannel = stackless.channel()
self.__resultsChannel = stackless.channel()
self.__tasklet = eg.Tasklet(self.ProcessingTask)(*args, **kwargs)
self.__tasklet.run()
return self
示例5: __init__
def __init__(self, f=AF_INET, t=SOCK_STREAM, p=0, s=None ):
#_socketobject_old.__init__(self,f, t, p, s)
self._sock = _realsocket_old(f,t,p)
om.create_object( self )
self.recv_buffer = create_string_buffer( 64 )
self.send_buffer = create_string_buffer( 64 )
self.send_ch = SL.channel( )
self.recv_ch = SL.channel( )
self.is_server = False
self.bind_addr=( "", 0 )
self.send_len = c_ulong()
self.recv_len = c_ulong()
self.recvol = OVERLAPPED()
self.sendol = OVERLAPPED()
self.init_recvol()
self.init_sendol()
self.connected = False
self.wasConnected = False
self.server_addr = None
self.recv_wsabuf = WSABUF()
self.send_wsabuf = WSABUF()
示例6: __init__
def __init__(self):
Abstract_actor.__init__(self)
self.channel = stackless.channel()
self.activate = stackless.channel()
self.queue = deque([])
self.channel.preference = -1
self.callbacks = {}
self.sync_parallel = []
示例7: __init__
def __init__(self, sock, addr):
self.socket = sock
self.address = addr
self.pid = sock.fileno()
self._rbuf = self._wbuf = ''
self.read_channel = channel()
self.write_channel = channel()
self.writing = self.reading = None
socket_map[self.pid] = proxy(self)
示例8: __init__
def __init__(self, lockName = ''):
self.name = lockName
self.rchan = stackless.channel()
self.wchan = stackless.channel()
self.rchan.preference = self.wchan.preference = 0
self.state = 0
self.tasklets = []
self.lockedWhen = None
locks.Register(self)
示例9: __init__
def __init__(self):
self.channel = stackless.channel()
self.activate = stackless.channel()
self.aref = ''
self.ref = False
self.group = None
self.queue = deque([])
self.channel.preference = -1
self.running = False
示例10: test_simple_pipe
def test_simple_pipe(self):
def pipe(X_in, X_out):
foo = X_in.receive()
X_out.send(foo)
X, Y = stackless.channel(), stackless.channel()
t = stackless.tasklet(pipe)(X, Y)
stackless.run()
X.send(42)
assert Y.receive() == 42
示例11: __init__
def __init__(self, lockName = 'noname'):
self.name = lockName
self.rchan = stackless.channel()
self.wchan = stackless.channel()
self.rchan.preference = self.wchan.preference = 1
self.nWaiting = [0, 0]
self.state = 0
self.owning = []
self.lockedWhen = None
lockManager.Register(self)
示例12: main
def main():
options, args = parser.parse_args()
leftmost = stackless.channel()
left, right = None, leftmost
for i in xrange(options.num_tasklets):
left, right = right, stackless.channel()
stackless.tasklet(f)(left, right)
right.send(0)
x = leftmost.receive()
print x
示例13: nest
def nest(X, Y):
X2, Y2 = stackless.channel(), stackless.channel()
t = stackless.tasklet(pipe)(X2, Y2)
dprint('tnp_N ==== 1')
X_Val = X.receive()
dprint('tnp_N ==== 2')
X2.send(X_Val)
dprint('tnp_N ==== 3')
Y2_Val = Y2.receive()
dprint('tnp_N ==== 4')
Y.send(Y2_Val)
dprint('tnp_N ==== 5')
示例14: __init__
def __init__(self, sock):
self.sock = sock
self.accepting = False
self.connected = False
self.remote_addr = None
self.fileobject = None
self.read_channel = stackless.channel()
self.write_channel = stackless.channel()
self.accept_channel = None
global sockets
sockets[id(self)] = self
runEventLoop()
示例15: __init__
def __init__(self):
self._rbuf = ''
self.headers = {}
self.environ = {}
self.content = []
self.headers_set = []
self.working_channel = None
self.read_channel = channel()
self.write_channel = channel()
self.write = self.content.append
self.eof = self.overflow = False
self.handle_read = self.read4cache