Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Multithreading 使用Haskell Graphics.Gloss时发生GLUT致命错误_Multithreading_Haskell_Graphics_Thread Safety_Glut - Fatal编程技术网

Multithreading 使用Haskell Graphics.Gloss时发生GLUT致命错误

Multithreading 使用Haskell Graphics.Gloss时发生GLUT致命错误,multithreading,haskell,graphics,thread-safety,glut,Multithreading,Haskell,Graphics,Thread Safety,Glut,我遵循并创建了一个demo.hs文件,其中包含以下内容: import Graphics.Gloss window :: Display window = InWindow "Nice Window" (200, 200) (10, 10) background :: Color background = white drawing :: Picture drawing = circle 80 main :: IO () main = display window background

我遵循并创建了一个
demo.hs
文件,其中包含以下内容:

import Graphics.Gloss

window :: Display
window = InWindow "Nice Window" (200, 200) (10, 10)

background :: Color
background = white

drawing :: Picture
drawing = circle 80

main :: IO ()
main = display window background drawing
但是,当我在终端中执行
runhaskell demo.hs
时,会收到以下错误消息:

GLUT Fatal Error: internal error: NSInternalInconsistencyException, reason: nextEventMatchingMask should only be called from the Main Thread!

这个错误是什么意思?我如何修复它?我使用的是macOS Sierra版本10.12.5。

Gui内容必须在macOS的主线程中完成。查看
forkOS
,了解如何在特定的操作系统线程上运行。我没有Mac电脑,但网上可能有一些关于在主线程上运行的文档Haskell@DanRobertson这里没有分叉。@Turion的确,
forkOS
没有使用
fork(2)
@DanRobertson,对不起,我不准确。我的意思是,在发布的示例OP中,没有涉及分叉。光泽不会分叉,它会阻塞主线程。@Turion分叉过程不同于使用多个线程。但是,如果您的声明是gloss在主线程上运行,您如何将其与上面的错误消息进行比较?