I'm traveling and will be limited access to work on the code. I'll respond to your questions now, but would suggest that you do not spend any time besides 'thinking' and asking me further questions/or offer 'gut-feel' ideas.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.