Porting an application with fork() to pthread_create()

倾然丶 夕夏残阳落幕 提交于 2019-12-01 14:27:05

It is exactly the same effort you would undergo in transitioning your application to a multi-threaded one on a unix platform. Simply replacing the forking code with calls to pthread_create() is - almost always - not enough. For instance, you may need to rewrite all of the code that supports inter-process communication. Say one process forks another, and then the two processes communicate through a pipe. Of course, this will not work anymore. Etc. You get the idea.

By the way, while pthreads are available and perfectly working on iOS, you are strongly encouraged to use other technologies available in iOS. For additional details, please read

Concurrency Programming Guide

in particular the Section called "Migrating Away from Threads".

For details about threading, see

Threading Programming Guide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!