I'm thinking about leaving 'is_video_recording()' out of all this. 'fileio_semaphore' seems to be a good indication of an ongoing movie recording. I think I have found its equivalent on VxWorks (in attachment) too, it's called "FileAccessSem" in the ixus30 fw.
We can't take this semaphore during a call to Fopen_Fut, because all _Fut functions appear to 'take' it.
So, taking care of open() seems to be possible (also in the attachment). Question is, what else do we want to protect.
- Fopen_Fut: we could 'take' and 'give' the semaphore right before the call, but doing that does not seem too professional nor is it 100% reliable. We could also switch to 'Fopen_FileStream' and protect it the same way as open().
- Other file system related functions: ?
edit:
link added
How confident are you that the VxWorks fileio_semaphore values are correct?
Seems like this is worth adding to SVN if the semaphore values are good.
Also, why only protect the _Open call with the semaphore for VxWorks? _Close and _Write are also protected for DryOS (or is this just due to the age of the patch).
Edit: I've replaced some of the fopen/fclose code with open/close, with the patch from srsa_4c, this seems to eliminate most of the lockups.
It might not be necessary to do anything about the fopen/fclose calls Lua uses fopen/fclose - running a script could still lockup if it tries to do file IO.
Update patch attached that works against current trunk - note, this includes some diagnostic code to capture and display various statistics for open/close/write.
Edit2: Updated patch to include semaphore timeout check in opendir and closedir. This prevents lockup if you try and save the edge overlay while recording a video
As I understand it the current state (with this patch) is:
- 1.2
- file IO using open/close available while recording video, can change and run scripts, load modules, etc.
- file IO using fopen/fclose while recording video will lockup the camera until video stops or battery pulled.
- risk of FSIoNotify assert shutting down camera at random times.
- 1.3
- file IO using open/close not available while recording video, cannot change script, load new modules, save settings, etc.
- file IO using fopen/fclose while recording video will lockup the camera until video stops or battery pulled.
- FSIoNotofy crash eliminated.
Phil.