Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > perl_parse and multi threading

Reply
Thread Tools

perl_parse and multi threading

 
 
lililevy@hotmail.com
Guest
Posts: n/a
 
      08-01-2006
Hello,

I would very much appreciate your answers on the following issue.
I have a multi threaded application. Each thread is running a function
that creates a perl interpreter and uses it to parse and then run a
perl function from an arbitrary file.
After running this application for a while I'm having a deadlock and
I can see that 10 threads are in the perl_parse function.
I'm running on WInXP with perl 5.8.3.809.
Are any of you are familiar with such a problem? Do you have an idea
why this can happen?

I've attached my function code and marked the line where the threads
are "stuck":

__declspec(dllexport)
long CFTPerlUserExitInstanceRun(char *FileName,char *FuncName,struct
PerlParmInfo *ParmsVec,unsigned int ParmsVecSize,char* pReason,int
*pCount,int *pUserExitRc)
{
long lRc = 0;
int count = -1;
PerlInterpreter* my_perl = NULL;

char *embedding[] = { "", FileName};

while (true)
{
my_perl = perl_alloc();
if (my_perl == NULL)
{
lRc = -1;
break;
}

EnterCriticalSection(&g_ParserCS);
PERL_SET_CONTEXT(my_perl);
PL_perl_destruct_level = 1;
perl_construct(my_perl);
LeaveCriticalSection(&g_ParserCS);

// ************************************************** ***
// THREADS ARE STUCK IN PERL_PARSE
// ************************************************** ***
lRc = perl_parse(my_perl, xs_init, 2, embedding , NULL);

if (lRc != 0)
{
lRc = -2;
break;
}

dSP;
ENTER;
SAVETMPS;

PUSHMARK(SP);


// push parms to stack
char ParmType[MAX_PARM_TYPE_LEN];

for(unsigned int i=0; i<ParmsVecSize; i++)
{
strncpy(ParmType, PERL_WRAP_PACKAGE_NAME,
MAX_PARM_TYPE_LEN-1);
strncat(ParmType, "::", MAX_PARM_TYPE_LEN-3);
strncat(ParmType, ParmsVec[i].parmtype, MAX_PARM_TYPE_LEN-
strlen(PERL_WRAP_PACKAGE_NAME)-3);

SV *pSVParm = sv_newmortal();
sv_setref_pv( pSVParm, ParmType, ParmsVec[i].parm );
XPUSHs(pSVParm);
}


PUTBACK;
try
{
count = call_pv(FuncName, G_EVAL|G_SCALAR);
}
catch(...)
{
lRc = -3;
}

SPAGAIN;

// Check the eval first
if (SvTRUE(ERRSV))
{
STRLEN n_a;
strncpy(pReason, SvPV(ERRSV, n_a), MAX_PERL_REASON_LENGTH-1);
//@G1028
lRc = -4;
POPs ;
}
else
{
if (count != 1)
{
*pCount = count;
lRc = -5;
}
else
{
*pUserExitRc = POPi;

}
}

PUTBACK ;
FREETMPS ;
LEAVE ;


break;
}

if (my_perl != NULL)
{
EnterCriticalSection(&g_ParserCS);
PL_perl_destruct_level = 1;
perl_destruct(my_perl);
LeaveCriticalSection(&g_ParserCS);
perl_free(my_perl);
}

return lRc;
}

Thank you very much.
Lily.

 
Reply With Quote
 
 
 
 
Reinhard Pagitsch
Guest
Posts: n/a
 
      08-03-2006
Hello,

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hello,
>
> I would very much appreciate your answers on the following issue.
> I have a multi threaded application. Each thread is running a function
> that creates a perl interpreter and uses it to parse and then run a
> perl function from an arbitrary file.
> After running this application for a while I'm having a deadlock and
> I can see that 10 threads are in the perl_parse function.
> I'm running on WInXP with perl 5.8.3.809.
> Are any of you are familiar with such a problem? Do you have an idea
> why this can happen?
>


Try to ask in perl.xs. I think they have more experience regarding this
issues.

regards,
Reinhard
 
Reply With Quote
 
 
 
 
anno4000@radom.zrz.tu-berlin.de
Guest
Posts: n/a
 
      08-03-2006
Reinhard Pagitsch <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> Hello,
>
> (E-Mail Removed) wrote:
> > Hello,
> >
> > I would very much appreciate your answers on the following issue.
> > I have a multi threaded application. Each thread is running a function
> > that creates a perl interpreter and uses it to parse and then run a
> > perl function from an arbitrary file.
> > After running this application for a while I'm having a deadlock and
> > I can see that 10 threads are in the perl_parse function.
> > I'm running on WInXP with perl 5.8.3.809.
> > Are any of you are familiar with such a problem? Do you have an idea
> > why this can happen?
> >

>
> Try to ask in perl.xs. I think they have more experience regarding this
> issues.


What is perl.xs? It's not a Usenet group.

Anno
 
Reply With Quote
 
Dr.Ruud
Guest
Posts: n/a
 
      08-03-2006
http://www.velocityreviews.com/forums/(E-Mail Removed)-berlin.de schreef:
> Reinhard Pagitsch:
>> lililevy:


>>> I would very much appreciate your answers on the following issue.
>>> I have a multi threaded application. Each thread is running a
>>> function that creates a perl interpreter and uses it to parse and
>>> then run a perl function from an arbitrary file.
>>> After running this application for a while I'm having a deadlock and
>>> I can see that 10 threads are in the perl_parse function.
>>> I'm running on WInXP with perl 5.8.3.809.
>>> Are any of you are familiar with such a problem? Do you have an idea
>>> why this can happen?

>>
>> Try to ask in perl.xs. I think they have more experience regarding
>> this issues.

>
> What is perl.xs? It's not a Usenet group.


You can find it as such at news://nntp.perl.org/perl.xs
and at several other mail2news-gateways.

--
Affijn, Ruud

"Gewoon is een tijger."


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Terminating a Python program that uses multi-process, multi-threading akineko Python 3 01-29-2009 02:26 PM
threading in PyQt vs threading in standard library Steven Woody Python 0 01-09-2009 07:15 AM
Cooperative threading preemptive threading - a bit confused failure_to@yahoo.co.uk Java 9 12-29-2007 01:10 AM
multi threading in multi processor (computer) ajikoe@gmail.com Python 38 02-15-2005 05:01 PM
perl_parse() crashes with no apparent reason Jan Engelhardt Perl Misc 0 10-14-2004 06:23 AM



Advertisments