There is an extra call to Pwait() in https://sourceforge.net/p/ldg/code/HEAD/tree/trunk/ldg/src/devel/ldgload.c#l158 after calling Pexec(4). This seems to be wrong: Pexec(4) already waits for the process to terminate. The problem with this is, if you have loaded some other libraries before with Slbopen(), that Pwait() will instead wait for those libraries to terminate, which they never do, causing Pwait() to wait forever. Even without Slbopen(), Pwait() will wait for any process to terminate, so there is no guarantee that it returns because the just loaded library has trminated. For that, you need to use Pwaitpid().
It's not clear for me what Pwait do exactly, looks like it is as Pwait3(2, NULL) but we wait Pexec(4,..) quit, so child for me is stopped and Pwait should report something, if I remember it is to not have zombie process, perhaps should more use Pwait3(3,NULL) in all case it will not wait, I have load several ldg in same time without this issue, does SLB are separate thread ?
Yes, Pwait() is identical to Pwait3(2, NULL), or Pwaitpid(-1, 2, NULL, NULL),as you can see here
The module you started with Pexec(4) already has exited, so there is nothing to report... unless you have loaded other libraries before with Slbopen(). They are handled a bit strange by MiNT: they are started also with Pexec(), but then they get a SIGSTOP signal sent once their init function has been called. That is why Pwait() hangs: it waits for them to exit or change their status, but they never do that. I think this is actually not handled quite right by MiNT, but i have currently no idea how to fix that, a similar Pwait() call is also done by MiNT itself to wait for the signal to arrive.
That might work too, haven't tried yet. But i think it should not be neccessary, at least not with recent MiNT kernels.
Yes, they are actually loaded similar to LDGs, with Pexec(3), then Pexec(106)
Ok, I will do the change this week using Pwait3(3,NULL) in case of need on old Mint Kernel, but I agree I should not need anything. Thanks for the help
Another idea (also not tried yet): you could use Pexec(104) instead of Pexec(4). That call does not wait, and should give you also the pid of the started Process, which you can use for Pwaitpid(pid, 2, NULL, NULL)
Yes possible but it not help to do faster
but use Pexec(104) is impossible for one reason: it doesn't work under single TOS. LDG work on any system
Yes, you are right, almost forgot that. But you could still do something like
Last edit: Thorsten Otto 2019-08-20
Yes but I not see any interest, it is just more complex
Thats up to you of course, but a single "if" does not look very complex ;)
Anyway, i'm fine with any solution that works. In the meantime, i try to fix that also in MiNT.