Skip to content

AsyncSaving

Narta Xaymar Dirks edited this page Oct 28, 2026 · 4 revisions
BlitzLLVM

AsyncSaving 〔BlitzLLVM〕

AsyncSaving:Void enabled:Int32
Parameter Mode Type Default Description
enabled In Int32 required True to save on other threads, False to wait for every file.

Description

〔BlitzLLVM〕 This command does not exist in the original Blitz products. BlitzLLVM adds it.

Turns saving of pictures on other threads on or off. It is off at first, and the environment variable BLITZLLVM_ASYNC_SAVE=1 turns it on for a program without changing it. With it on, SaveBuffer, SaveImage and SaveTexture read the pixels at once (so a picture drawn over right afterwards does not change what is saved), return 1, and the encoding and writing of the file go on another thread while the program does other things. Encoding a big picture as JPEG XL or a high compression PNG can take a good part of a second, which is a hitch in a game that takes a screenshot.

SavesPending says how many saves are not done, and SavesFailed how many of them could not write their file. A program that ends (with End, by running out of lines or with a runtime error) waits for the saves that are still going on, so the files are always written. Saving the same file again while the first save is going on waits for the first one. Settings and the title for the metadata are taken when the command is called. A save that is refused at once (a format that can't be written, a buffer that does not exist) still gives 0.

A program compiled with -d (a debug build) ignores this command and BLITZLLVM_ASYNC_SAVE, and always saves on the spot, so a save that fails is reported by the command that asked for it. Release builds do what is described above.

This is a BlitzLLVM extension: the originals write every file before the command returns.

Differences

  • With asynchronous saving on, a file that can't be written (a folder that does not exist, a full disk) is not a 0 from the save command, but is counted by SavesFailed.

Related Commands

AsyncLoading 〔BlitzLLVM〕, AutoMidHandle, CopyImage

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally