Results 1 to 2 of 2
  1. #1
    kwaspl is offline Member
    Join Date
    Dec 2009
    Posts
    4
    Rep Power
    0

    Default Thread without run() method

    I have a problem and i can't seem to find correct solution using Google. I write application using JNI and in that app the c++ code makes callbacks to Java method and i need that to be realize by a separated thread but when in a run() method i use
    Java Code:
    public void metchodToBeCalledFromCpluspluc(byte[] arr)
    {int result = processArrayInJava(arr);}
    
    public void run()
    {
    while(thrue) 
    ;
    }
    it seem to blocking calls from that function. Can you pint me to the right direction?

  2. #2
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    I really don't know what you're expecting, but of you call a run method that does nothing but endlessly loop, I guess i would expect it to lock up a full CPU...and it sounds like that's what it's doing. What are you expecting?

    If you want to launch a Java thread from native code, don't directly call the 'run' method. That isn't how you create or start a thread. Instead, call a method that creates your thread and starts it.

Similar Threads

  1. Using Thread waiting() method
    By nicoeschpiko in forum New To Java
    Replies: 7
    Last Post: 12-11-2010, 09:24 PM
  2. Using Thread waiting() method
    By nicoeschpiko in forum Advanced Java
    Replies: 1
    Last Post: 12-11-2010, 04:50 PM
  3. Thread problem, calling method in run method
    By majk in forum Threads and Synchronization
    Replies: 4
    Last Post: 09-27-2010, 12:40 PM
  4. Trigger main thread method from secondary thread?
    By DigitalMan in forum Threads and Synchronization
    Replies: 8
    Last Post: 01-26-2010, 03:13 AM
  5. [SOLVED] Method from one thread called on another thread
    By Ypsilon IV in forum Threads and Synchronization
    Replies: 7
    Last Post: 04-24-2009, 03:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •