I've just finished the first release of Thread::Apartment, and seek the indulgence of, and feedback from, the monastery.

Note: Thread::Apartment has not yet been CPAN'd, as I hope to exersize it more thoroughly in an application I'm developing... and perhaps get some feedback from the Monks in the interim...

(For the unfamiliar, apartment threading is a method of isolating an object (or object hierarchy) within its own thread and exposing its interfaces via lightweight proxy objects.)

Background: My initial attempt at apartment threading occured while trying to make DBI more "threadable". The result was DBIx::Threaded, and the associated module Thread::Queue::Duplex. Once I managed to get that running, I realized

  1. I really needed a general apartment threading solution for a complex application I'm working on that has significant concurrency and scalability requirements
  2. I could probably leverage the experiences gleened from DBIx::Threaded to develop a more generalized apartment threading wrapper for Perl objects
  3. With such a wrapper, I could quite possibly expose other complex, legacy modules in a thread-safe way (most notably for my purposes, Perl/Tk)

While this initial release falls short of permitting (3) (due to unimplemented support for closure proxies), I think I've covered most of the important ground to make OO Perl more "threadable" (albeit, at some performance expense) ala Java's threading capabilities.

I've also begun pondering whether Thread::Apartment may also provide a nice foundation for fully distributed objects (tho without the use of threads::shared elements). Assuming that some sockets or IPC based subclasses of Thread::Queue::Duplex, Thread::Apartment::Server, and Thread::Apartment::Client were created, it should be feasible to build fully distributed object architectures entirely in Perl.

Have I overlooked something simple in Perl that already handles all of this ? Or worse, overlooked something which could cause this house of cards to tumble ?

Comments/suggestions/concerns welcome.


In reply to Apartment Threading in Perl by renodino

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.