develooper Front page | perl.perl5.porters | Postings from March 2014

Re: RFC: add discouragement warning to perl threads documentation

Thread Previous | Thread Next
Christian Walde
March 2, 2014 01:20
Re: RFC: add discouragement warning to perl threads documentation
Message ID:
On Sun, 02 Mar 2014 02:01:36 +0100, Leon Timmermans <>  

> I'm not quite sure what you mean with "threads can crash easily if  
> shared data isn't meticulously flagged". On a C >level, threads::shared  
> shouldn't segfault [...]  If it does segfault, that is a bug that needs  
> to be addressed.
Note: By crash i am talking about any improper program termination, not  
just segfault, and also conflating data corruption into it for brevity.  
Keep in mind that that warning is meant to inspire fear, not to be  
technical reference material. ;)

Specifically though i was thinking of a situation where an incompletely  
marked complex data structure is made available to two threads, resulting  
in them messing with it at the same time. If that can't happen, please  
correct me with suggestions on wording.

> (and in fact, it does use a global lock[1]).
That's not a global lock, but a lock on shared variables. A global lock is  
when only one thread can execute at any one time. (See Python.) :)

> Also, asynchronous libraries are only a useful replacement when using  
> threads to multiplex IO, when you actually >want to do multiprocessing  
> the only alternative is forking (which obviously isn't helpful on  
> Windows…)
That is why it says "many situations", not "all situations".

OT: Threads are in my experience actually more stable on windows than on  
linux. That said, i'd rather not discuss here what could be used for what.  
That would be a fine topic for another thread, which i'd be glad to see  
made by you or leonerd, but this one would just be led into the woods by  

With regards,
Christian Walde
Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About