Coder Social home page Coder Social logo

Comments (5)

Boris-Rasin avatar Boris-Rasin commented on May 20, 2024

As a workaround, you can call once in each thread created from C++:

scapix::link::java::attach_current_thread();

For convenience, I can also add generic version of this function (which will do nothing with other bridge languages):

scapix::init_thread();

I can also add optional automatic thread attachment:

target_compile_definitions(scapix PUBLIC SCAPIX_JNI_AUTO_ATTACH_THREAD)

I want to make it optional because it would add slight runtime overhead on each JNI call.

What do you think?

from scapix.

nadrolinux avatar nadrolinux commented on May 20, 2024

Hi,
I think that 3rd option with optional auto attachments is the best, because of automatic nature, but I agree that marked it as optional is better choice, because in this way we can still rely on options 1 and/or 2 if auto performance will be a problem. Please just remember that for option no. 2 you should also add 'scapix::exit_thread' or similar with internal 'scapix::link::java::detach_current_thread()' call.
Thanks for a quick response and good solutions as always.
Patryk

from scapix.

Boris-Rasin avatar Boris-Rasin commented on May 20, 2024

Commit: 0256e3f
Documentation: https://www.scapix.com/java_link/threads/

from scapix.

Boris-Rasin avatar Boris-Rasin commented on May 20, 2024

Released in cmodule v1.0.35:
https://github.com/scapix-com/cmodule/releases

from scapix.

nadrolinux avatar nadrolinux commented on May 20, 2024

Great, thanks a lot.

from scapix.

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.