Hide menu
Loading...
Searching...
No Matches
Subprocess Mode

Table of Contents

Overview

Subprocess mode allows to run model importing in a separate process. When enabled the ModelData_ModelReader runs an instance of CadExHost executable and redirects all calls to the reader methods to it.

This behavior is controlled by the Base_Settings::SubprocessMode feature-flag. By default, this flag is set to true. To take advantage of subprocess mode this flag should be set to true as follows:

// Enable subprocess mode
static const std::shared_ptr< Base_Settings > & Default()
Returns global settings object.
Definition: Base_Settings.cxx:541
@ SubprocessMode
Definition: Base_Settings.hxx:41

This will affect all subsequently created ModelData_ModelReader objects.

Benefits

Subprocess mode allows to guard the user code from errors that lead to application crashes (such as access violation signal for instance) during model importing. All such errors are caught in the main process and the user is notified by the BaseError_UnexpectedProcessExit exception. The user application can continue working after handling this exception.

ModelData_Model aModel;
try {
ModelData_ModelReader aReader;
aReader.Read ("myfile.stp", aModel);
}
catch (BaseError_UnexpectedProcessExit& theException) {
// Fatal error in a separate process
std::cerr << "Error: unexpected process exit with code " << theException.ExitCode() << std::endl;
}
catch (Base_Exception& theException) {
std::cerr << "Error: " << theException.What() << std::endl;
}
See also
Error handling

Limitations

Subprocess mode is available on Windows only, on other platforms use of the Base_Settings::SubprocessMode feature-flag will have no effect.

Delayed Conversion is temporarily disabled in call to ModelData_ModelReader::Read method when subprocess mode is available and enabled.