One (C) thread per server connection?
Yes. Note: Several of the C API can end-up creating independent C threads, each with a separate connection to the server.
Does that thread procedure sit in a block loop?
Yes. Depnding on 'responses' from the server, it will take appropriate actions, including invoking CCB at appropriate times.
One PCB per thread?
Not necessarily.
What does the Perl script do whilst waiting for PCBs to be called?
Not much, Id say. The script typically goes like this : Call an API, go into a "while" loop, waiting on a flag for the expected PCB to complete. PCB sets the flag, passes the results back thru another variables. (Perl HASH wrappers for the underlying C structures). Depending on the results, proceeds with the next action/API until a pass/fail verdict can be produced.
Is there only (ever?) one Perl thread?
There are no perl_clone's anymore. So, only one Perl context created by perl.exe itself. But, you probably didnt mean that by Perl thread: I do not create any perl level threads (itheads?) in the perl script. Its a 'main' & a bunch of helper subs (in a separate .pm) and a bunch of PCBs.
However, I would like, if possible, to allow script developer flexibility to use perl threads in the future.
Can two C-threads attempt to call the same PCB?
No, though there is a many-to-1 relation between PCBs and C-threads, each PCB is handled only by one C-thread.
Concurrently?
Umm..technically it maybe possible : I mean, two C-threads each calling a separate PCB 'concurrently' (i.e a 2nd PCB is invoked before 1st PCB completes). I believe all the C-threads are at the same priority, so its not likely. However, I'm certain there is no such situation occuring with the simple scripts that are giving me problems now.
The system follows an multi-threaded, multi-process, async event-driven programming model. The Perl script built using the wrapped C-API is the driver/initiator of all activities. Each perl script would try to exercise a specific scenario that that could occur in a production app.
I am more than happy to provide further details, but may not be seeing what details will help you. So, appreciate you asking specific question.
Hope this helps and thanks once again!
In reply to Re^14: Perl crash during perl_clone
by perlmonk1729
in thread Perl crash during perl_clone
by perlmonk1729
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |