开发者

Check array for change in data

I need some help with C++. I have a thread running in the background that keeps continuously checking for data and upon some conditions met it will process that data. data is stored in an char array[]. I want to use this array in some other script. ( I can access this array from other script).

I want to do some thing like this with the script... if ever there is a data change in this array ( or if new data arrives ) pro开发者_开发知识库cess that data.

don't have any idea about this.... please help :)


You need condition variables. They're in virtually every threading API. You can block on them until the condition becomes true. You need to refer to whatever implements your threading for more details.


WHatever method you use to create threads (i.e. a library, operating system functions etc.) will provide you with a way to synchronize data access and / or provide events that you can use to be notified in case the data has changed.

A more specific answer would require you to give more details about how you manage concurrency.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜