You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, the program can be interrupted while a thread is writing its buffer into the output memory/file. This results in a band visible in the output image.
Let's implement SIGTERM handling, which interrupts the worker threads only at specified points (i.e. not while writing to a file)
The text was updated successfully, but these errors were encountered:
Cleanup function for thread cancellation needs to be implemented. This function is registered via void pthread_cleanup_push(void (*routine)(void *), void *arg);, and optionally can be executed via void pthread_cleanup_pop(1); http://man7.org/linux/man-pages/man3/pthread_cleanup_push.3.html
During sensitive operation, the cancellability state needs to be disabled via pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL), and otherwise enabled via pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL). The cancellability type can be asynchronous, because we only care about the consistency of the output arrays and counters, which are modified when the cancel state is disabled. However, everyone keeps advising against that, so let's use deferred instead. This is done via pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);. http://man7.org/linux/man-pages/man3/pthread_setcancelstate.3.html
Right now, the program can be interrupted while a thread is writing its buffer into the output memory/file. This results in a band visible in the output image.
Let's implement SIGTERM handling, which interrupts the worker threads only at specified points (i.e. not while writing to a file)
The text was updated successfully, but these errors were encountered: