hi there

basically...I have instantiated long term running thread/s.

in the main thread, i want to pass a subroutine (code ref) and its parameters 
into a threads::shared variable, then execute it in a separate thread running 
in a while loop.

I want to do this, because having a group of a couple instantiated long term 
running threads, before processing starts, would be less expensive, then 
instantiated many short term threads for each call...which would be expensive 
and affect performance due to the lag in thread creation.

calls and subroutine's/parameters will vary, so injecting the code into a 
running thread is what i would like.

I hope you all now can understand. Thanks in advance for your help.

Regards,
- Jeremy A. 
 

Quoting John Serink <[EMAIL PROTECTED]>:

> Why don't you pass the parameters as references.....
> They work like pointers in C kindof.
> 
> Why do you want to reference your subroutine?




> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On 
> > Behalf Of [EMAIL PROTECTED]
> > Sent: Tuesday, July 26, 2005 2:19 AM
> > To: $Bill Luebkert
> > Cc: perl-win32-users@listserv.ActiveState.com
> > Subject: Re: references 
> > 
> > 
> > hello again,
> > 
> > > > hello all,
> > > > 
> > > > here is a ref/deref problem
> > > > 
> > > > I need to take a socket handle, convert it to a socket 
> > ref, then a 
> > > > scaler
> > > > string 
> > > > 
> > > > A bit later in the same script, I need to take that scaler string 
> > > > and turn
> > > it
> > > > back to a socket ref, and deref it back to the socket handle.
> > > 
> > > Maybe instead of asking for the way to implement your solution, you 
> > > should describe the complete problem and see if we can come 
> > up with an 
> > > alternate solution that is a little less convoluted.  :)
> > 
> > let me clarify my problem.
> > 
> > I have a reference of a subroutine.
> > 
> > eg.
> > 
> > $sub = "test";
> > 
> > ..deref and execute
> > 
> > &$sub;
> > 
> > ...
> > 
> > sub test {
> > my ($sockethandle,$blah...) = @_;
> > ..do something
> > }
> > ........
> > 
> > in order to pass the paramenters, i decided to do this : 
> > 
> > sub main {
> > 
> > my $sub = "test|$sockethandle";
> > ($sub,@_) = split(/\|/,$sub);
> > 
> > $&sub;
> > }
> > 
> > 
> > if this is to work correctly, I need to take a socket handle, 
> > convert it to a 
> > socket ref, then a scaler, so i can pass it as a parameter. 
> > in order to use the 
> > socket later, i have to take the scaler, convert it to the 
> > socket ref, then 
> > dereference it.
> > 
> > Is there an easier way to pass parameters with a subroutine 
> > reference? 
> > 
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Perl-Win32-Users mailing list 
> > Perl-Win32-Users@listserv.ActiveState.com
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> > 
> 




_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to