Closed dmik closed 5 years ago
Actually, with P_PM support added within #63, nothing special seems to be necessary — if the app passes P_PM instead of P_SESSION when starting a PM application, it works well both through the wrapper and directly. That's because P_PM causes the application type of our wrapper to be changed to PM (even if it's built as a console app) so that things like message queue creation succeed.
So the only problem is when P_SESSION is used with the wrapper (P_2_THREADSAFE) and the PM application. In this case, our wrapper stays console and hence the described problem with the message queue. I'm sure that if e.exe
could morph itself into PM (as our Qt can), then it would be no problem there as well. And while we can detect the application type and force P_PM when P_SESSION is given (or simply return EINVAL), I think it's too high level for spawn2
. We will leave this up to the caller to decide what they actually want.
So I'm closing this as won't fix.
Since our wrapper is a console application, it can't start PM applications directly as its children. One solution is to provide a different wrapper version which is a PM application.
Now, if a PM application (e.g.
C:\OS2\e.exe
) is about to be started byspawn2
in P_2_THREADSAFE mode, it will simply immediately terminate (note thatDosExecPgm
returns a valid PID in such a case and no error). Most likely,e.exe
fails to create a message queue and exits.