Subject: | Thread safety - IUP::Canvas::Bitmap gets mangled when (unrelated) thread finishes |
use strict;
use warnings;
use threads;
use feature 'say';
use IUP ':all';
my $x = IUP::Canvas::Bitmap-> new( CD_RGB, 100, 100 );
say $x-> Width;
async( sub { })-> join;
say $x-> Width;
which says
100
0
The workaround to have permanent worker threads for application lifetime is not always convenient.
C:\>perl -v
This is perl 5, version 24, subversion 0 (v5.24.0) built for MSWin32-x86-multi-thread-64int