You can create a custom thumbnail, even before the Humax writes one, and regardless of the hmt's flag bit condition, once a .thm exists it will not be overwritten by the Humax.
I disagree. This is an area I have experience with, and is a typical problem in a multi-processing environment with processes competing for resources (this is usually handled at the operating system level, so processes operating at a lower priority don't need to worry about it, but in this case there is no OS involved and the
humaxtv process does not expect to have anything contending with it).
I admit that it is an unlikely case, but unlikely cases have a habit of turning up and biting you. The exact circumstances are these: the WebIF decides to create a custom .thm. At around the same time,
humaxtv looks for a .thm and doesn't find one because it has not been created yet, so starts generating one. If we are lucky, the two processes clash at the file creation stage and the OS throws up an error. If we are unlucky, the WebIF completes the creation of the .thm and releases it before the
humaxtv process starts writing its own version. The WebIF .thm then gets over-written by the Humax version, and unless the flag is actually contained in the .thm file there is nothing to indicate this has happened.
af123 will decide to implement it anyhow he wants, how successful it will be depends on experience in multi-processing programming. In my opinion the least troublesome will be to restrain the .thm generation until the
humaxtv process has already generated and released its own .thm file, this will ensure there are no conflicts later. If he wishes to implement an "early" generation strategy, some means is required to detect that a collision has occurred, and the effect of having the .thm open for writing at the same time as
humaxtv tries to write to the file needs to be tested. Without the means to control
humaxtv, we have to work around it.
My engineering team used to handle this kind of thing in hardware (because it can't be completely solved in software unless the hardware support exists). There are several ways to approach it, I think these days indivisible read-test-write cycles are the defacto implementation, but the way we did it using the technology of the day was to have a special hardware register associated with each resource which would only accept a write if the ID field matched the equivalent field in the attempted write, or the "reserved" flag was clear. With the "reserved" flag clear, process A attempts to acquire the resource by writing ID=A, "reserved" to the register. Process A then reads the register, and finds ID=A, so knows it now has control of the resource. While process A has the resource, process B attempts to acquire the resource by writing ID=B, "reserved" to the register. Process B reads the register back, and finds ID=A because the write was not accepted. Process B then has to try again later. When process A has finished, it writes ID=A, "not reserved" to the register. Next time another process attempts to acquire the resource it will be successful.
I'm not saying af123, Raydon, xyz321
et al are in this category, but most people have no idea how much goes on inside their PCs etc to make things work properly!