Coder Social home page Coder Social logo

Comments (8)

felfert avatar felfert commented on July 21, 2024

AFAIK, This is the documented behaviour of java.nio.channels.spi.AbstractInterruptibleChannel.
You need to use begin()/end() pairs, if you want to interrupt the thread.
See https://docs.oracle.com/javase/7/docs/api/java/nio/channels/spi/AbstractInterruptibleChannel.html#be

from jnr-unixsocket.

gregw avatar gregw commented on July 21, 2024

@felfert but begin/end are protected methods, so I can't call them directly. Surely it is the JNR implementation of UnixServerSocketChannel#accept that should be calling them?

from jnr-unixsocket.

gregw avatar gregw commented on July 21, 2024

Specifically, shouldn't this line be wrapped in begin/end pairs?

from jnr-unixsocket.

headius avatar headius commented on July 21, 2024

@gregw I think you're right. Can you help us patch this?

from jnr-unixsocket.

gregw avatar gregw commented on July 21, 2024

@headius #25 is a PR that adds begin/end calls. It makes it a little bit better, but doesn't generally fix the problem? At least not on Linux Tile440 4.2.0-30-generic #36-Ubuntu SMP Fri Feb 26 00:58:07 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

from jnr-unixsocket.

headius avatar headius commented on July 21, 2024

Fix this for 0.14.

from jnr-unixsocket.

leifwalsh avatar leifwalsh commented on July 21, 2024

I think the way to do accept() with an interrupt or timeout is to call select() first, check if the socket is ready, and then call accept() knowing there's a connection to accept. You could set things up so that one of the sockets passed to select() is something that a thread wanting to interrupt it could close or otherwise signal, separate from the socket you're actually trying to accept on, and you could implement a version of the api with a timeout.

from jnr-unixsocket.

swankjesse avatar swankjesse commented on July 21, 2024

Fixed in #65

from jnr-unixsocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.