开发者

Large number of critical sections

Environment: C++,VS 2008, MFC, app for Windows XP. I have to access & modify a tree structure in 2 threads. My idea is to protect each node with an CCriticalSection that would lo开发者_C百科ck each and every time the node inner data (not child) gets accessed. I am expecting large number of nodes (2-300000).

Can the very large number of critical sections be a problem?

I heard that Windows has an issue with large numbers of open handles, that is why I am asking this.


Unlike mutexes, Critical sections are not kernel objects and only require an OS handle as soon as there is actual attempt by two threads to lock it. read this Matt Pietrek article if you want to know how it works.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜