🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
2 messages
2 total messages Started by Andrew Sat, 09 Oct 1999 00:00
Re: Embedding Perl into a threaded program
#40724
Author: Andrew
Date: Sat, 09 Oct 1999 00:00
51 lines
2777 bytes
In article <yl7lkwpdqv.fsf@windlord.stanford.edu>, Russ Allbery wrote:
>Well, for what it's worth, one of the Perl threading experts backed up my
>memory of how the Perl folks think it works and what their experiences
>have been.
>
>What version of Perl did people here try it with?

5.005_03.

>From: Dan Sugalski <dan@tuatha.sidhe.org>
>Newsgroups: comp.lang.perl.moderated
>Subject: Re: Embedding Perl into a threaded program
>Date: Sat, 09 Oct 1999 17:45:22 GMT
>
>Russ Allbery <rra@stanford.edu> wrote:
>> My understanding from previous discussion here and on p5p is that Perl
>> (even when not built threaded itself) can be safely embedded into a
>> threaded program provided that only one thread instantiates and talks to
>> the interpretor and the other threads keep their hands off and route all
>> communication to the embedded Perl code through that one thread.
>
>As long as only one thread is in *any* perl interpreter at any one time,
>you can safely embed perl in a threaded app. Perl itself really doesn't
>care about what OS thread is executing it.

And provided Perl is not using its own malloc, or otherwise providing
non-thread-safe replacements for any system functions.

>> I've now gotten a report that another person had no end of trouble doing
>> this.
>
>There was probably something else going on. He might have built with
>MULTIPLICITY and assumed you were OK as long as no two threads were in the
>same interpreter but it was OK to have two threads in two separate
>interpreters at the same time or something. (An assumption that's not
>true, BTW)

No; only one interpreter was involved. Access to that interpreter was
controlled by a single mutex lock.

>The only place I can see you getting in trouble is if one thread allocates
>a perl data structure on its stack (naughty, naughty thread!) and hands it
>off to perl.

Nope; nothing like that going on.

-- 
Andrew, Supernews
http://www.supernews.com - UK and US individual and corporate NNTP services

Re: Embedding Perl into a threaded program
#40728
Author: Andrew
Date: Sun, 10 Oct 1999 00:00
18 lines
1345 bytes
In article <ylbta7j0cm.fsf@windlord.stanford.edu>, Russ Allbery wrote:
>Andrew <andrew+news@supernews.com> writes:
>> Russ Allbery wrote:
>
>>> What version of Perl did people here try it with?
>
>> 5.005_03.
>
>Did you compile Perl threaded or non-threaded?

Non-threaded (but with -D_REENTRANT). Platform was Solaris 2.6, I'm
not sure if we tried both on sparc and x86, it certainly broke on x86.

-- 
Andrew, Supernews
http://www.supernews.com - UK and US individual and corporate NNTP services

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads