A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/1999-July/000606.html below:

[Python-Dev] End of the line

[Python-Dev] End of the lineMark Hammond mhammond@skippinet.com.au
Wed, 28 Jul 1999 00:45:12 +1000
[Jack seems to like an asynch IO model]

> def foo():
> 	obj = stdin.delayed_read()
> 	obj2 = stdout.delayed_write("data")
> 	do_lengthy_computation()
> 	data = obj.get()	# Here we wait for the read to complete
> 	del obj2		# Here we wait for the write to
> complete.
>
> This gives a fairly nice programming model.

Indeed.  Taking this a little further, I come up with something like:

   inlock = threading.Lock()
   buffer = stdin.delayed_read(inlock)

   outlock = threading.Lock()
   stdout.delayed_write(outlock, "The data")

   fired = threading.Wait(inlock, outlock) # new fn :-)

   if fired is inlock: # etc.

The idea is we can make everything wait on a single lock abstraction.
threading.Wait() could accept lock objects, thread objects, Sockets, etc.

Obviously a bit to work out, but it does make an appealing model.  OTOH, I
wonder how it fits with continutations etc.  Not too badly from my weak
understanding.  May be an interesting convergence!

Mark.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4