开发者

processing large data using multiple threads of same code in linux C

can multiple threads of same function be created to process large arrays in small blocks?

i am trying to do it in Linux C, assume i have read() it is reading data from serial into array, when array is full it is passed for processing to stable(), meanwhile it is processed, read should be reading new data, because stable() is taking long to process 开发者_Go百科old data, so newly created thread of stable() should be processing new data available in array.

problem is i am confused, can i create two threads of stable() in Linux C?


Each thread created using the pthreads API specifies an entry point that should match the standard signature:

void *entry(void *)
{
   return 0;
}

Once that entry point has been called, you can invoke anything that you want including the stable() routine that you referenced above. You will need to be careful, however, to ensure that stable() and anything that it calls is thread safe.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜