Re: 2.6, 3.0, and truly independent intepreters



On Oct 24, 9:40 pm, "Martin v. Löwis" <mar...@xxxxxxxxxxx> wrote:
It seems to me that the very simplest move would be to remove global
static data so the app could provide all thread-related data, which
Andy suggests through references to the QuickTime API. This would
suggest compiling python without thread support so as to leave it up
to the application.

I'm not sure whether you realize that this is not simple at all.
Consider this fragment

    if (string == Py_None || index >= state->lastmark ||
!state->mark[index] || !state->mark[index+1]) {
        if (empty)
            /* want empty string */
            i = j = 0;
        else {
            Py_INCREF(Py_None);
            return Py_None;



The way to think about is that, ideally in PyC, there are never any
global variables. Instead, all "globals" are now part of a context
(ie. a interpreter) and it would presumably be illegal to ever use
them in a different context. I'd say this is already the expectation
and convention for any modern, industry-grade software package
marketed as extension for apps. Industry app developers just want to
drop in a 3rd party package, make as many contexts as they want (in as
many threads as they want), and expect to use each context without
restriction (since they're ensuring contexts never interact with each
other). For example, if I use zlib, libpng, or libjpg, I can make as
many contexts as I want and put them in whatever threads I want. In
the app, the only thing I'm on the hook for is to: (a) never use
objects from one context in another context, and (b) ensure that I'm
never make any calls into a module from more than one thread at the
same time. Both of these requirements are trivial to follow in the
"embarrassingly easy" parallelization scenarios, and that's why I
started this thread in the first place. :^)

Andy



.



Relevant Pages

  • Re: setting an older version of office as default
    ... app from the Open With options in the contextual menu. ... you double-click a Word document in the Finder, ... the older version as the default applications for doc and ppt files. ... The only thing I've found to work that sticks is changing the context menu ...
    (microsoft.public.mac.office)
  • Re: Mighty Mouse: a step backwards for Apple
    ... I seldom use context menus. ... >> to app or even window to window. ... >> Otherwise, to me, it's just a kludge to make up for bad windows UI ... My hands are usually _on_ the keyboard, ...
    (comp.sys.mac.advocacy)
  • Re: How to pass Application.Item value back to class?
    ... Can't you pass the application settings as a parameter to ... As the context is entirely different(I mean the web context and your ... processing classes), or in other words,configuration is different from ... >>Suggestions please for strategy to share values across app. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Data loss appending data to file
    ... To put you in context, the app reads a text file one character at the time in binary mode and "emulates" the behavior of various line printers before storing the data of a printer page in a string array. ... Context switch back to Thread 1 which now executes the SetFilePointer() with the handle that now belong to Thread 2. ... I found the error by replacing all calls to the Windows API by library file access. ...
    (microsoft.public.win32.programmer.kernel)