How to make GLFW window non blocking

Hello I am creating some openGL GUI and I have probably simple to solve problem - I want to have the rendering loop non blocking i.e so for example I will be able to run the openGL app and make it possible to 1) respond to keyboard and mouse inputs 2) respond to the inputs from REPL now when I start While loop for obvious reason the REPL is blocked and can not be used.
I tried using @async but in this case for some reason it closes immidiately
I tried using Distributed worker and @spawnat 2 … but in this case the input from GUI like for example closing the window do not work

my simple rendering/event loop

function sipmpleeventLoop(window)
    try
        while !GLFW.WindowShouldClose(window)
            GLFW.PollEvents()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        end
    finally
        GLFW.DestroyWindow(window)
    end

end

thanks for help !!

Ok I figured it out :slight_smile:

	t = @task begin;
		while(!GLFW.WindowShouldClose(window))
		 sleep(0.1);
		 glClear()             
		 # Poll for and process events
		  GLFW.PollEvents()
		end
		end
	schedule(t)