Closed ags799 closed 10 years ago
The locking here is a bit tricky. I'm not sure I have all of it figured out yet either.
The thing I've found is that some of the libcec functions that are called from the main thread appear to call indirectly into the callbacks, and that it's essential that I release the GIL before calling any of the libcec functions. I think I fixed the majority of these in 5c0d0fdbf9108a3414b7e7531f9bc1afe9684009 , but there may still be a few hanging around to get caught up on.
I don't think there's a race condition. I was calling a method on a Python object that was properly instantiated.
I've added some code to
command_cb()
so that my Python program may receive raw CEC messages. I've added a call to a Python method in between thePyGILState_Ensure()
andPyGILState_Release()
statements .The method typically doesn't produce any noticeable action, unless that action is very quick. For example, I can print a hard-coded string like 'CEC message received', but I can't print
str(some_object)
. This behavior occurs even when I run the program undergdb
.I think this qualifies as a race condition. I don't see how, I thought that the
PyGILState_Ensure()
would take care of this.Any ideas? Thanks in advance.