Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Fork and creating a thread exits the process

by ikegami (Patriarch)
on Aug 12, 2020 at 14:42 UTC ( [id://11120652]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Fork and creating a thread exits the process
in thread Fork and creating a thread exits the process

I can't make heads or tails of anything you are saying. These three points should handle it all, though:

  • Perl uses real threads (pthread_create where available).

  • Thread-safe XS libraries are possible, and many are. But supporting multi-threading may require extra work. (This isn't specific to XS.) For example, JSON::XS isn't thread safe (because its author intentionally refuses to support them on principle), but Cpanel::JSON::XS is.

  • There's nothing wrong with using threads in unix.

  • If you want to perform aynchronous operations, Coro is one of many useful approaches. Just beware that if any of your Coro threads use something that's incompatible with the event loop being used by Coro, everything will block since it's a co-operative multi-tasking system.

  • If you want parallel processing, you'll need OS-level tasks (e.g. threads or processes), not what Coro provides.

Update: I meant "that's incompatible". Fixed.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11120652]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-24 02:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found