Skip to main content
Skip table of contents

(v13) Handling interrupts

This page applies to Harlequin v13.1r0 and later; and to Harlequin MultiRIP but not Harlequin Core

If a device function takes a while to do some processing, it should periodically check to see if the Harlequin MultiRIP has been interrupted.

This is done by calling the Harlequin MultiRIP function SwOften() . This function normally returns 0 and nothing needs to be done, but if this function returns -1 the device routine should abort and should return DeviceInterrupted on the next call to the device's last_error() function. It is expected that existing code that calls SwOften() should not need to be changed to support this method of handling interrupts.

For example, if a device routine needs to write a large amount of data, it should not be written in one operation, but should use code something like this:

      int32 bytes_written = 0; while (len > 0)
        int32 this_size; int32 result;
        this_size = (len > CHUNK) CHUNK : len;
        result = underlying_write(desc, buff, this_size); bytes_written += result;
        buff += result; len -= result;
        if (SwOften() == -1)
            error = Device Interrupted; return -1;
      return bytes_written;

In this example code listing error handling has been omitted for clarity.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.