This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: virtual IO for embedding Py in server
Type: enhancement Stage:
Components: None Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, draghuram
Priority: normal Keywords:

Created on 2001-08-28 11:14 by anonymous, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (3)
msg61064 - (view) Author: Nobody/Anonymous (nobody) Date: 2001-08-28 11:14
Embedding Py inside an Admin server program could be 
extremly useful. 

This is how I wish to embedd Py:
1. The server program runs on Windows NT. thus fork ()
   is not applicable. 

2. The server is Multi-User, thus Py needs to be
   thread-safe - global variables need to be 
   eliminated or locked.

3. The server needs to process the input & output of 
   Py. furthermore, the server communicates with 
   clients in several methods, not all can be
   represented with a FILE* object.

My request is that
a) Py will be made thread-safe, so several scripts
   could be run simultaneously in the same process,
   by different users.

b) Py will 'virtualize' IO in an object-oriented 
   like manner. This is difficult, since Py is
   implemented in C, but not impossible.
   consider this struct as a possible replacement 
   for FILE* & fprintf:


// typedef for 'this'
typedef void* VContext;     

// typedef for function pointers
typedef void (p_vflush*)(VContext) // func. pointer
typedef void (p_vprintf*)(VContext, 
                          const char *format,
                             ....);

struct VOutput {
 p_vflush vflush;
 p_vprintf fprintf;
 
 VContext vcontext;
};

it is fairly easy to implement FILE* style IO
using this style, and it allows a much more flexible
ways of doing IO.





The two major issues hold back embedding 
msg61065 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-05-13 01:59
Logged In: YES 
user_id=357491

Making the core thread-safe is a tremendous undertaking.  I doubt it will 
happen any time soon if ever.

As for your virtualized IO, Guido is working on a stream-based IO package to 
allow standardized control over IO.  You might want to have a look.  It is in 
the nondist/ directory of the CVS and its called sio .
msg62292 - (view) Author: Raghuram Devarakonda (draghuram) (Python triager) Date: 2008-02-11 19:19
I am closing it as there is no activity for long time. Please reopen if
required.
History
Date User Action Args
2022-04-10 16:04:23adminsetgithub: 35061
2008-02-11 19:19:14draghuramsetstatus: open -> closed
nosy: + draghuram
messages: + msg62292
2001-08-28 11:14:43anonymouscreate