[Python-Dev] pre-PEP: The Safe Buffer Interface
Scott Gilbert
xscottg@yahoo.com
Mon, 29 Jul 2002 09:45:32 -0700 (PDT)
--- Neil Hodgson <nhodgson@bigpond.net.au> wrote:
> Scott Gilbert:
>
> > You could easily implement the a counting (recursive) mutex as
> > described above, and it might be the case that throwing an exception
> > on the length changing operations keeps the dead lock from occurring.
> > I'm still a bit confused though.
>
> Not as confused as I am. I don't think deadlocks or threads are that
> relevant to me. The most likely situations in which I would use the
> buffer interface is to perform large I/O operations without copying or
> when performing asynchronous I/O to load or save documents while
> continuing to run styling or linting tasks. I think its likely that the
> pieces of code accessing the buffer will not be real threads, but instead
> be cooperating contexts within a single-threaded UI framework so using
> semaphores will not be possible.
>
What happens when you've locked the buffer and passed a pointer to the I/O
system for an asynchronous operation, but before that operation has
completed, your main program wants to resize the buffer due to a user
generated event?
I had written responses/questions to other parts of your message, but I
found that I was just asking the same question above over and over, so I've
chopped them out. If you can explain this to me, and there aren't any
problems with deadlock or polling, then I'll quit interfering and let you
and Thomas decide if you really think the locking semantics are useful to a
wide enough audience that it should be included in the core.
>
> I don't want counting mutexes. I'm not defining behavior that needs
> them.
>
You said you wanted the locks to keep a count. So that you could call
acquire() multiple times and have the buffer not truly become unlocked
until release() was called the same amount of times. I'm willing to adopt
any terminology you want for the purpose of this discussion. I think I
understand the semantics or the counting operation, but I want to
understand more what actually happens when the buffer is locked.
__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com