I have a program that while it is working displays graphs regularly via replot().

The Problem is, the program stops working when the OS screen lock is activated under Linux.
As a cause I could identify that it must be the plotting of graphs with replot(). I was able to localize that the reason is clearly the replot() function.

I have tested the following variants:

The problem is always: If the function is called when the screen of linux is locked, it blocks the whole program.

How to solve the problem? It should not happen that the program can no longer work when the Linux-screen is locked.

kind regards