MCPcopy Create free account
hub / github.com/MrKepzie/Natron / flush

Method flush

Engine/MemoryFile.cpp:380–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378}
379
380bool
381MemoryFile::flush(FlushTypeEnum type, void* data, std::size_t size)
382{
383 void* ptr = data ? data : _imp->data;
384 std::size_t n = data ? size : _imp->size;
385#if defined(__NATRON_UNIX__)
386 switch (type) {
387 case eFlushTypeAsync:
388 return ::msync(ptr, n, MS_ASYNC) == 0;
389 case eFlushTypeSync:
390 return ::msync(ptr, n, MS_SYNC) == 0;
391 case eFlushTypeInvalidate:
392 return ::msync(ptr, n, MS_INVALIDATE) == 0;
393 default:
394 break;
395 }
396#elif defined(__NATRON_WIN32__)
397 switch (type) {
398 case eFlushTypeSync: {
399 bool ret = (bool)::FlushViewOfFile(ptr, n) != 0;
400 if (ret) {
401 ret = (bool)::FlushFileBuffers(_imp->file_handle);
402 }
403 return ret;
404 } break;
405 case eFlushTypeAsync:
406 return (bool)::FlushViewOfFile(ptr, n) != 0;
407 case eFlushTypeInvalidate:
408 return true;
409 break;
410 }
411#endif
412 return false;
413}
414
415MemoryFile::~MemoryFile()
416{

Callers 9

onProcessCanceledMethod · 0.45
writeToOutputChannelMethod · 0.45
runMethod · 0.45
beginFunctionMethod · 0.45
printMethod · 0.45
endFunctionMethod · 0.45
deallocateMethod · 0.45
syncBackingFileMethod · 0.45
CacheClass · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected