sync#

Flush pending writes from a mapped scalar back to disk.

תקציר#

sync $map;         # synchronous - wait for the kernel to finish
sync $map, 0;      # asynchronous - queue the flush and return

ארגומנטים#

  • $lvalue - a currently mapped scalar.

  • $synchronous - defaults to true. When true, sync does not return until the kernel reports the data on stable storage. When false, the flush is only queued.

The mapping is always flushed automatically when the scalar goes out of scope, so explicit calls to sync are only needed when you want other processes, or a crash-safe on-disk snapshot, to see the changes before then.

מקרי קצה#

  • Calling sync on an unmapped scalar raises an exception.

  • Calling sync on an empty mapping is a no-op.

הבדלים מן ה-upstream#

Fully compatible with upstream File::Map 0.71.

ראו גם#

  • unmap - release the mapping (also triggers a flush).

  • advise - influence the kernel’s write-back strategy.