Hi,
I'm trying to record audio in a separate thread (actually two, but it doesn't work with even just one). Here's a full working example, which breaks if I use the line that is commented out.

Code:
import appuifw
import audio
import e32
import thread

class Example:
    def __init__(self):
        self.sound_file_name = u'C:\\data\\sound.wav'
        self.lock = e32.Ao_lock()

    def run(self):
        appuifw.app.exit_key_handler = self.quit
        self.sound_file = audio.Sound.open(self.sound_file_name)
        self.recording = True
        thread.start_new_thread(self.record, ())
        self.lock.wait()
        self.stop()

    def record(self):
        #self.sound_file.record()
        print u'Recording'
        e32.ao_sleep(1)
        self.sound_file.stop()
        print u'Exiting'

    def stop(self):
        print u'Stopping'
        self.sound_file.close()

    def quit(self):
        print u'Quitting'
        self.lock.signal()

if __name__ == '__main__':
    example = Example()
    example.run()
This prints out "Recording" and then "Exiting" once one second has passed, as expected. If I use the line commented out, nothing prints out. If I call record() normally in the main thread, everything works just fine.

Can someone tell what I'm doing wrong here?