本文整理汇总了Python中stackless.channel函数的典型用法代码示例。如果您正苦于以下问题:Python channel函数的具体用法?Python channel怎么用?Python channel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了channel函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 = []
开发者ID:a8ksh4,项目名称:junk,代码行数:7,代码来源:pingpong2d.py
示例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()
开发者ID:bahamut8348,项目名称:xkcode,代码行数:30,代码来源:test2.py
示例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')
开发者ID:Qointum,项目名称:pypy,代码行数:31,代码来源:test_stackless.py
示例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
开发者ID:tfroehlich82,项目名称:EventGhost,代码行数:7,代码来源:TaskletDialog.py
示例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()
开发者ID:bahamut8348,项目名称:xkcode,代码行数:33,代码来源:iocp.py
示例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 = []
开发者ID:cloudspaces,项目名称:pyactive,代码行数:8,代码来源:tasklet.py
示例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)
开发者ID:ZoomQuiet,项目名称:eurasia,代码行数:9,代码来源:socket2.py
示例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)
开发者ID:Pluckyduck,项目名称:eve,代码行数:9,代码来源:uthread.py
示例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
开发者ID:sergitoda,项目名称:pyactive,代码行数:9,代码来源:tasklet.py
示例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
开发者ID:Qointum,项目名称:pypy,代码行数:10,代码来源:test_stackless.py
示例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)
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:10,代码来源:__init__.py
示例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
开发者ID:dnslj,项目名称:python-labs,代码行数:10,代码来源:tasklets.py
示例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')
开发者ID:Qointum,项目名称:pypy,代码行数:12,代码来源:test_stackless.py
示例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()
开发者ID:pcgod,项目名称:stackless-mumble-server,代码行数:12,代码来源:socketlibevent.py
示例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
开发者ID:ZoomQuiet,项目名称:eurasia,代码行数:12,代码来源:fcgi.py
示例16: start
def start(self):
#errqueue = Queue()
#statqueue = Queue()
errlog = ErrLog('epoll_mp_srv')
statlog = StatLog('epoll_mp_srv')
errqueue = stackless.channel()
statqueue = stackless.channel()
stackless.tasklet(StackLessLog)(errqueue,errlog)
stackless.tasklet(StackLessLog)(statqueue,statlog)
stackless.run()
handle_proc = MPConsumer(self.srvsocket,self.epoll,errqueue,statqueue)
handle_proc.setDaemon(True)
handle_proc.run()
开发者ID:yjdwbj,项目名称:python-examples,代码行数:13,代码来源:epoll_mp_srv.py
示例17: __init__
def __init__(self, chainSize):
self.chainSize = chainSize
self.instrChannel = stackless.channel()
self.chainChannel = [stackless.channel() for i in range(chainSize)]
self.chain = [None for i in range(chainSize)]
for nodeID in range(chainSize):
self.chain[nodeID] = \
stackless.tasklet(
self.nodeFunction)(nodeID,
self.instrChannel,
self.chainChannel[nodeID],
self.chainChannel[(nodeID -1) % self.chainSize],
self.chainChannel[(nodeID + 1) % self.chainSize])
开发者ID:a8ksh4,项目名称:junk,代码行数:13,代码来源:dingdong.py
示例18: __init__
def __init__(self, sock):
# This is worth doing. I was passing in an invalid socket which was
# an instance of dispatcher and it was causing tasklet death.
if not isinstance(sock, stdsocket.socket):
raise StandardError("Invalid socket passed to dispatcher")
asyncore.dispatcher.__init__(self, sock)
self.acceptChannel = stackless.channel()
self.connectChannel = stackless.channel()
self.readChannel = stackless.channel()
self.readBuffer = ''
self.outBuffer = ''
开发者ID:grant-olson,项目名称:why_stackless,代码行数:14,代码来源:stacklesssocket.py
示例19: __init__
def __init__(self, numberOfNodes):
self.numberOfNodes = numberOfNodes
meshState = [False for i in range(self.numberOfNodes)]
self.instChannel = stackless.channel()
self.meshChannel = [stackless.channel() for \
i in range(self.numberOfNodes)]
self.meshNode = [None for i in range(numberOfNodes)]
for node in range(len(self.meshNode)):
self.meshNode[node] = \
stackless.tasklet(self.nodeFunction)(node, \
self.instChannel, self.meshChannel)
开发者ID:a8ksh4,项目名称:junk,代码行数:14,代码来源:nodeMesh.py
示例20: close
def close(self):
if hasattr(self, "db"):
if self.changed or self.deleted:
e = channel()
self.queue.put((e, self._close_and_sync, (), {}))
errno, e = e.receive()
if errno != 0:
raise e
else:
e = channel()
self.queue.put((e, self._close, (), {}))
errno, e = e.receive()
if errno != 0:
raise e
开发者ID:noscripter,项目名称:eurasia,代码行数:14,代码来源:shelve2.py
注:本文中的stackless.channel函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论