Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Keeping an INET socket inside a shared object

by oiskuu (Hermit)
on Jan 18, 2014 at 19:04 UTC ( [id://1071134]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Keeping an INET socket inside a shared object
in thread Keeping an INET socket inside a shared object

That's the blocking mechanism, and it's not limited to just sockets either. Multiple writes may block each other similarily. Set your fd nonblocking if this is a problem...

  • Comment on Re^3: Keeping an INET socket inside a shared object

Replies are listed 'Best First'.
Re^4: Keeping an INET socket inside a shared object
by BrowserUk (Patriarch) on Jan 18, 2014 at 20:17 UTC
    Set your fd nonblocking if this is a problem...

    And how do you think non-blocking works with threads?

    What happens if 2 threads issue a select against the same thread and a state transition occurs -- ie. the socket becomes readable or writable -- which thread responds? Answer: they both do.

    And what happens when they both try to read from or write to the same socket at the same time?

    In a single threaded app, a socket is only readable or only writable at any given moment. Being single-threaded means that the code can only ever try to do one thing or another at a time. Ie. serially bi-directional.

    In single threaded apps it doesn't matter. In multi-threaded apps it does.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2024-04-23 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found