readme
来自「ace开发环境 用来开发网络程序 其运用了设计模式、多平台、C++等多种知识」· 代码 · 共 28 行
TXT
28 行
invariants.cpp tests the ACE Token Invariant utilities. The ACE TokenInvariant utilities allow an application to test the correctness ofmutex and readers/writer locks.invariants.cpp takes no command-line arguments. invariants.cpp firsttests readers/writer locks. This is done by spawning two threadswhich simulate reader and writer acquire/renew/release loops.However, the loops are performed without actual locks, so thecompeting threads quickly reach and invalid state. The test shouldreport this violation of readers/writer lock invariants and boththreads should exit.The second test is for mutexes. Similar to the readers/writer locktest, this test spawns two threads which perform acquire/renew/releaseloops. When to two threads reach an invalid mutex state, the errorshould be reported and the threads should exit.For these two previous tests, it is theoretically possible that thethreads never reach an invalid token state. However, it is highlyunlikely since the threads would have to execute the same codesimultaneously for the duration of the test. Nevertheless, it ispossible.The last test hardwires invalid token states. It runs two mutex andtwo readers/writer lock tests. It should report "succeeded" for thefour tests.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?