I was trying to call an Octave function from a python program using two threads. My octave code is just to see how it works -
testOctave.m
function y = testOctave(i)
y = i;
end
And the python program just tries to call it
from oct2py import octave
import thread
def func(threadName,i) :
print "hello",threadName // This printf works
y = octave.testOctave(i)
print y // This is ignored
print 'done' // This is ignored
print 'exiting' // This is ignored
try:
thread.start_new_thread( func, ("Thread-1", 100 ) )
thread.start_new_thread( func, ("Thread-2", 150 ) )
except:
print "Error: unable to start thread"
The program exits without giving any errors, but in the above function, the first print is only executed, all prints following the octave call are ignored by both threads. Is there a reason why this happens, and what can I do to make it work?
The program doesnt do anything in particular, Im just trying to figure out how to work with oct2py