Re: Lots of context switches with shared array

2008-09-23 Thread Dean Arnold
Thomas Karcher wrote: Hi Dean, If someone from the ithreads development team is listening: I guess this is an issue worth considering to have a solution for ... e. g. a thread-safe array (similar to Thread::Queue) or a more fine-granular locking mechanism for shared arrays ... not that I

Re: p5p summary: Improving threads::shared ?

2008-05-08 Thread Dean Arnold
Jerry D. Hedden wrote: perhaps we could just provide a function: $y = shared_clone($x); What name should this function have? shared_clone() clone() shared_copy() copy() make_shared() Or something else? I'd vote against clone() or copy(), as they're too general.

Re: p5p summary: Improving threads::shared ?

2008-05-06 Thread Dean Arnold
Dean Arnold wrote: Jerry D. Hedden wrote: Conceptually, I think it would require keeping a weak reference of each private SV associated with a shared SV. This would need to be done on a per-thread basis. Then when a thread tries to reference a shared SV, a lookup would be made to see

Re: p5p summary: Improving threads::shared ?

2008-05-05 Thread Dean Arnold
Jerry D. Hedden wrote: What are your thoughts regarding structures that mix shared and non-shared elements? Should a whole separate clone be made, or should that shared portions (i.e., refs) be used in the copy? (I'm thinking the latter, while messier, makes more sense.) I agree. That most

Re: p5p summary: Improving threads::shared ?

2008-05-05 Thread Dean Arnold
Jerry D. Hedden wrote: I've attached my reworked version of T::Q that I think takes care of circular references. Would you mind giving it a going over? (It passes all the currents tests in its test suite, so I know I didn't break anything.) Thanks. My sample worked OK *after* I removed the

Re: p5p summary: Improving threads::shared ?

2008-05-05 Thread Dean Arnold
Jerry D. Hedden wrote: erry D. Hedden wrote: Look at $x: REF(0x144f8f0) REF(0x144f8f0) REF(0x144f8f0) REF(0x144f8f0) REF(0x144f8f0) REF(0x144f8f0) First look at $y: SCALAR(0x1423c70) SCALAR(0x1423ad8) SCALAR(0x14bd968) SCALAR(0x14bd980)

Re: p5p summary: Improving threads::shared ?

2008-05-05 Thread Dean Arnold
Jerry D. Hedden wrote: Is this a logical approach? If so, is it doable? If circular references can't be fully supported in threads::shared, then I need to document this in its POD and in Thread::Queue's POD, too. Do you agree? I don't know that they can't be supported; but they do need

Re: p5p summary: Improving threads::shared ?

2008-05-04 Thread Dean Arnold
Dean Arnold wrote: Jerry D. Hedden wrote: Dean Arnold wrote: I've been pouring over the p5p archives trying to find what the subject p5p summary item is about, but wo/ any luck. Can someone point out the relevent thread title, or maybe summarize what threads::shared could share aggregates

Re: Perl threads under Windows

2008-04-20 Thread Dean Arnold
, Dean Arnold

Re: Perl threads under Windows

2008-04-19 Thread Dean Arnold
, and probably most other GUI libs, due to the event control loop). Good luck, Dean Arnold

Re: Perl threads under Windows

2008-04-19 Thread Dean Arnold
Octavian Rasnita wrote: Passing messages to a window might not seem very complicated, but if there are more windows, and many rules based on admin's preferences, on user's schedule, or by user's request, might make the program a spaghetti application. I think what I want to do should be a

Re: Passing an IO:Handle to a Thread

2008-02-29 Thread Dean Arnold
Dave Mitchell wrote: On Wed, Feb 27, 2008 at 08:15:36AM -0800, Dean Arnold wrote: As to shared object destruction: pre-5.10.0: once per thread, requires some extra bookkeeping to make sure it does the right thing 5.10.0: once in the last referencing thread (fixed in CORE) Huh? use

Re: Invoking method in other thread context

2008-01-09 Thread Dean Arnold
rarely, so it is (and hopefully someday, will be) much faster. But the overhead issues still apply. Every inter-thread operation is expensive. Thanks, Shmuel. HTH, Dean Arnold Presicient Corp.

Re: Invoking method in other thread context

2008-01-08 Thread Dean Arnold
assuming thread A is running an instance of class XYZ with method callme(), and thread B is running an instance of class DEF that holds a proxy object $threadA to thread A's apartment, then thread B can call $threadA-callme() directly, ie, no closures needed. But the overhead issues still apply. Dean

Re: simple multithread daemon

2007-11-14 Thread Dean Arnold
stdin_to_client() gets its exit. Dean Arnold Presicient Corp.

Re: [PATCH] Bug fix for storing shared objects in shared structures

2007-11-06 Thread Dean Arnold
Jerry D. Hedden wrote: The attached patches fix this bug. Thank to Dean Arnold for the suggestion to use a PL_ function pointer. Just to double check: does this permit *any* blessed, tied SV to make use of this feature (assuming it's tie module chains the PL_destroyhook) ? Or only threads

Re: shared XS object destruction and _refcnt

2007-08-20 Thread Dean Arnold
in the context of the thread which is about to cause refcount to drop to zero. OTOH, I suppose thats a lot of work to avoid a simple if (refcnt() == 1) {} in the DESTROY code. But it does feel a bit more natural. Dean Arnold

Re: Thread-safe perl XS modules

2007-06-26 Thread Dean Arnold
...but that could require mutexes if multiple threads are concurrently destroying) Alternately, you might try using a threads::shared version of the object, tho that will complicate your constructor. You may eventually need to do a deeper debug of your segfault to get exact lines where the fault occurs. Dean

Re: Solaris Threads create issue

2007-05-24 Thread Dean Arnold
Brian Foddy wrote: Using Solaris 2.8 and Perl v5.8.7 built for sun4-solaris-thread-multi What version of threads and threads::shared are you using ? Those modules have been dual-lifed for awhile now, and the recent CPAN versions tend to behave better than older CORE versions. Dean Arnold

Re: Help needed

2007-02-07 Thread Dean Arnold
there's an equivalent in *nix using /dev/tty or somesuch, but my POSIX system programmer skills are a bit rusty. Dean Arnold Presicient Corp.

Re: Multithreading not using most of my resources

2006-12-11 Thread Dean Arnold
-thread stack size. See http://search.cpan.org/~jdhedden/threads-1.53/threads.pm#THREAD_STACK_SIZE and http://www.perlmonks.com/?node_id=533058 for details. HTH, Dean Arnold Presicient Corp.

Re: Sharing hashes

2006-10-11 Thread Dean Arnold
Christopher Fowler wrote: I think I'm understanding things correctly. I've started on my second exercise and have working code. Here is the basics of the program 1. It does a ping heartbeat on various hosts 2. A piece of data is shared among threads. 3. There is a thread for each target.

Re: sharing objects

2006-10-10 Thread Dean Arnold
simplified it 4) I've replaced your @obj ad-hoc queue with Thread::Queue, which handles the needed locking (which it appears you weren't applying) Code below. NOTE: I've not run it, it likely has some syntax errors. HTH, Dean Arnold Presicient Corp. package Packet; use threads; use threads

Re: sharing objects

2006-10-10 Thread Dean Arnold
Dean Arnold wrote: Christopher Fowler wrote: On Tue, 2006-10-10 at 09:23 -0500, Michael J. Pomraning wrote: I've done a quick rewrite of your example (note I have no idea what the function of your script is, but the Packet class is a pretty simple container class, so hopefully this captures