Results 1 to 2 of 2
Thread: Thread without run() method
- 04-17-2011, 12:08 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 4
- Rep Power
- 0
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) ; }
- 04-18-2011, 04:47 AM #2
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 13
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
-
Using Thread waiting() method
By nicoeschpiko in forum New To JavaReplies: 7Last Post: 12-11-2010, 09:24 PM -
Using Thread waiting() method
By nicoeschpiko in forum Advanced JavaReplies: 1Last Post: 12-11-2010, 04:50 PM -
Thread problem, calling method in run method
By majk in forum Threads and SynchronizationReplies: 4Last Post: 09-27-2010, 12:40 PM -
Trigger main thread method from secondary thread?
By DigitalMan in forum Threads and SynchronizationReplies: 8Last Post: 01-26-2010, 03:13 AM -
[SOLVED] Method from one thread called on another thread
By Ypsilon IV in forum Threads and SynchronizationReplies: 7Last Post: 04-24-2009, 03:07 PM
Bookmarks