Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] thread safe tools.c



Rainer Zocholl wrote:

This is a patch to add thread safe functins to tools.c
Serveral other functions in vdr and (that's the problem)
plugins uses some of those return "static". So the entire patches maybe to long to post?


Of course the non"_r" counter parts will become superflous,
so a rename is not required.
But removing them now would cause serveral plugins not
to compile anymore.

I have not checked if all those functions are really called in two threads at the same time, so the plugins may run
without patching (at least mostly, because the problematic
timing windows are usually very small, not reproducible, and the side effects may not cause segfaults.).

I think "AddDir" maybe very critical as it is used by many plugins
and VDR is not using it only while in init, AFAS.

So sorry for the non developers:
This will not be the last patch to make vdr thread proof.



I have patched the caller modules to use the new functions
and found no new problems generated, but 4..10 eyes may see more ;-)

Thank you for this. I just noticed that this patch got a little corrupted in this one hunk so becareful when applying it. But other than that, it seems to be working just fine.

@@ -468,19 +532,28 @@
system("sync");
remove(buf);
gettimeofday(&tp2, NULL);
- double seconds = (((long long)tp2.tv_sec * 1000000 + tp2.tv_usec) - ((long long)tp1.tv_sec * 100
0000 + tp1.tv_usec)) / 1000000.0;
+ double seconds = (((long long)tp2.tv_sec * 1000000 + tp2.tv_usec) - ((long long)tp1.tv_sec * 100
0000 + tp1
+.tv_usec)) / 1000000.0;






Home | Main Index | Thread Index