Use different thread when writing content file

This should reduce the possibility that the same
memory error is going to affect all the written
content files in the same way.
This commit is contained in:
Andrea Mazzoleni 2015-10-29 23:37:58 +01:00
parent 80476c480b
commit fcf7c44197
3 changed files with 323 additions and 161 deletions

View file

@ -129,6 +129,18 @@ int sopen_multi_file(STREAM* s, unsigned i, const char* file)
return 0;
}
STREAM* sopen_write(const char* file)
{
STREAM* s = sopen_multi_write(1);
if (sopen_multi_file(s, 0, file) != 0) {
sclose(s);
return 0;
}
return s;
}
int sclose(STREAM* s)
{
int fail = 0;