根据GHC用户指南,外国电话可以标记interruptible,但是,我无法使其工作.我ghc 8.4.3在GNU/Linux上使用.
例如,参见cbits.h:
/* cbits.h */
void loopForever();
Run Code Online (Sandbox Code Playgroud)
cbits.c:
/* cbits.c */
#include <stdio.h>
#include <unistd.h>
#include "cbits.h"
void loopForever()
{
for (;;)
{
printf("Tick\n");
sleep(1);
}
}
Run Code Online (Sandbox Code Playgroud)
最后是Test.hs:
-- Test.hs
{-# LANGUAGE InterruptibleFFI #-}
module Main where
import Control.Concurrent
import Control.Concurrent.Async
main :: IO ()
main = race_ loopForever $ do
threadDelay 2000000
putStrLn "Finished"
foreign import ccall interruptible "cbits.h"
loopForever :: IO ()
Run Code Online (Sandbox Code Playgroud)
我把它全部编成了ghc -threaded -o a.out cbits.c Test.hs.
现在,我预计 …
我有一个字符串,如何将其转换为数组?
操作该数组后,如何再次将其变为字符串?
PHP中的字符串是否与Java中的字符串相同?
这有什么骗局?