首页 \ 问答 \ 如何在普通C中启动线程?(How do I start threads in plain C?)

如何在普通C中启动线程?(How do I start threads in plain C?)

我在C中使用了fork()来启动另一个进程。 如何开始新的线程?


I have used fork() in C to start another process. How do I start a new thread?


原文:https://stackoverflow.com/questions/56810
更新时间:2024-02-01 16:02

相关问答

更多
  • 在minXRec的第二个守卫中,你没有条件测试。 你需要改变 | minXRec [p1, p2, a*p1+p0] [q1, q2, a*q1+q0] newM newD newA n 最有可能的 | otherwise = minXRec [p1, p2, a*p1+p0] [q1, q2, a*q1+q0] newM newD newA n In the second guard of minXRec you don't have a conditional test. You will need ...
  • 你需要::在函数类型之前。 -- vv here v0 :: [Pos] -> Matrix -> [Pos] v0 [] _ = [] -- v v also parenthesis, not square brackets v0 (p:ps) m = if ((takeH m p) == 0) then v0 ps else p:v0 ps You need :: before the type of a function. ...
  • 虽然从发布的代码中无法分辨出来,因为SO至少会在一段时间内将制表符转换为空格,但问题可能是您在putStrLn之前输入了一个字面制表符,而不是四个空格,就像您为其他两行do块,反之亦然。 do块中的所有语句do必须以完全相同的空格开始,而不是直观地排列起来。 如果您使用的是可以以特殊方式显示文字标签的文本编辑器,请将其设置为这样; 它会为你节省一些头痛。 Though it's impossible to tell from your posted code because SO converts tabs ...
  • 您在where关键字之前使用制表符。 对于GHC,它看起来像这样: ␉ where␠(f:_)␠=␠firstname ␠␠␠␠␠␠␠␠␠(l:_)␠=␠lastname 因此,GHC认为where块中的第一行从第14列开始(第8行的选项卡计数为iirc),而第二行从第9列开始,这会导致错误。 您应该使用一个好的文本编辑器,将标签转换为4个空格。 You use a tab character before the where keyword. To GHC it looks like th ...
  • 在Haskell源文件中,不应该使用let -just write来引入像f这样的顶级定义 f [] = [] f ('\n':',':a) = f ('\n' : a) f (a:b) = a : f b 此外,您需要确保定义中每个子句的左侧在同一列中排列,因为Haskell是缩进感知的。 因此,在这种情况下,每个子句中的f应该位于每行的最开头,如上所述。 请注意,ghci提示的行为更像是在do块中,因此let是有效的,这在两者之间移动时可能会引起混淆。 In Haskell source files, ...
  • 因为Haskell中的空白是很重要的。 您需要遵循缩进规则或使用显式大括号和分号(如在第二个代码块中)。 以下是修复第一个块的两种方法(还有其他方法): sgetLine = do x <- getChar if x == '\n' then do putChar x return [] else do ...
  • 我无法在本地重现错误,所以我的猜测是你使用制表符空格,如果你复制粘贴代码到编辑器,它应该“工作”。 在这种情况下,我们会收到另一个错误: GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( tmp.hs, interpreted ) tmp.hs:7:1: error: Equations for ‘apply’ have different numb ...
  • 在第133行中,左括号比右对齐多3个,每行的每一侧必须有相同数量的括号。 In line 133 you have got 3 more left brackets than right ones, you must have equal number of brackets for each side in each line.
  • 你在fix_error的定义中交换了=和if 。 定义的语法是: name args = body if表达式的语法是: if condition then true_branch else false_branch 你只需要结合这些: fix_error erro = if isDoesNotExistError erro ---- then do putStr "Exception: file doesn't exist" ... else io ...
  • 你把parens放在错误的地方了吗? expression2 = (do operator lexer "|" a <- alternate as <- expression2 return $ a:as) <|> return [] Did you put the parens in the wrong place? expression2 = (do operator lexer "|" a <- alternate ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。