Hi Shimuuar,
I'm wondering about the following:
Is it possible that we create a PyEnv or a readerT-like scoped monad enviroment (ReaderT PyEnv IO a), instead of implicitly accesing a global mutable object over IO?
dataPyEnv=PyEnv{pyState::TVarPyState
, pyLock::TVarPyLock
, pyEvalQ::Maybe (MVarEvalReq) , pyGcChan::Maybe (Chan (PtrPyObject))
, pyMainTid::MaybeThreadId
, pyGcTid::MaybeThreadId
, pyInterpTS::PtrPyThreadState}newtypePya=Py{unPy::PyEnv->IOa}-- or ReaderT PyEnv IO awithPythonEnv:: (PyEnv->IOa) ->IOa
withPythonEnv k = bracket newInterpreter closeInterpreter k
runPyWith::PyEnv->Pya->IOa
runPyWith env (Py m) = runReaderT m envAlso I would like to know, what are the essential difficulties that blocks the possibility to have multiple threads running (potentially) multiple python instances?
I'm not familiar with the codebase or difficulties that arises from it (so, sorry if I'm requesting something silly here!), but I'm curioius and I think it would be very useful (for many applications), if we could create multiple PyEnv (for multiple threads), we could potentially be running several python instances, each within a different scope?
Thanks a lot!
Hi Shimuuar,
I'm wondering about the following:
Is it possible that we create a PyEnv or a readerT-like scoped monad enviroment (ReaderT PyEnv IO a), instead of implicitly accesing a global mutable object over IO?
Also I would like to know, what are the essential difficulties that blocks the possibility to have multiple threads running (potentially) multiple python instances?
I'm not familiar with the codebase or difficulties that arises from it (so, sorry if I'm requesting something silly here!), but I'm curioius and I think it would be very useful (for many applications), if we could create multiple PyEnv (for multiple threads), we could potentially be running several python instances, each within a different scope?
Thanks a lot!