Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by oiskuu (Friar)
on Jan 18, 2014 at 19:04 UTC ( #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 (Pope) 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
Node Status?
node history
Node Type: note [id://1071134]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (19)
As of 2015-07-31 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (278 votes), past polls