Mercurial > ecos-v3_0-branch
comparison packages/kernel/current/tests/mutex3.cxx @ 115:6ed91473a1cd ecos-sw-2000-08-21
Merge from eCos master repository on 2000-08-21-22:40:54-BST
| author | jlarmour |
|---|---|
| date | Fri, 25 Aug 2000 17:32:38 +0000 |
| parents | 435cced73e2f |
| children | eb9fd8c04db3 |
comparison
equal
deleted
inserted
replaced
| 114:5ad2b71d525e | 115:6ed91473a1cd |
|---|---|
| 59 | 59 |
| 60 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK) && \ | 60 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK) && \ |
| 61 (CYGNUM_KERNEL_SCHED_PRIORITIES > 20) | 61 (CYGNUM_KERNEL_SCHED_PRIORITIES > 20) |
| 62 | 62 |
| 63 // ------------------------------------------------------------------------ | 63 // ------------------------------------------------------------------------ |
| 64 // Manufacture a simpler feature test macro for priority inheritance than | |
| 65 // the configuration gives us. We have priority inheritance if it is configured | |
| 66 // as the only protocol, or if it is the default protocol for dynamic protocol | |
| 67 // choice. | |
| 68 // FIXME: If we have dynamic protocol choice, we can also set priority inheritance | |
| 69 // as the protocol to be used on the mutexes we are interested in. At present we | |
| 70 // do not do this. | |
| 71 | |
| 72 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_INHERIT | |
| 73 # ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC | |
| 74 # ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DEFAULT_INHERIT | |
| 75 # define PRIORITY_INHERITANCE | |
| 76 # else | |
| 77 # undef PRIORITY_INHERITANCE | |
| 78 # endif | |
| 79 # else | |
| 80 # define PRIORITY_INHERITANCE | |
| 81 # endif | |
| 82 #else | |
| 83 # undef PRIORITY_INHERITANCE | |
| 84 #endif | |
| 85 | |
| 86 // ------------------------------------------------------------------------ | |
| 64 // Management functions | 87 // Management functions |
| 65 // | 88 // |
| 66 // Stolen from testaux.hxx and copied in here because I want to be able to | 89 // Stolen from testaux.hxx and copied in here because I want to be able to |
| 67 // reset the world also. | 90 // reset the world also. |
| 68 | 91 |
| 248 do { | 271 do { |
| 249 now = Cyg_Clock::real_time_clock->current_value(); | 272 now = Cyg_Clock::real_time_clock->current_value(); |
| 250 // Wait longer than the delay in t3 waiting on go_flag | 273 // Wait longer than the delay in t3 waiting on go_flag |
| 251 } while ( now < (then + 3) ); | 274 } while ( now < (then + 3) ); |
| 252 | 275 |
| 253 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INHERITANCE | 276 #ifdef PRIORITY_INHERITANCE |
| 254 CYG_TEST_INFO( "Checking for MUTEX_PRIORITY_INHERITANCE" ); | 277 CYG_TEST_INFO( "Checking for mutex priority inheritance" ); |
| 255 CYG_TEST_CHECK( 1 == t3ran, "Thread 3 did not run" ); | 278 CYG_TEST_CHECK( 1 == t3ran, "Thread 3 did not run" ); |
| 256 CYG_TEST_CHECK( 1 == got_it, "Thread 1 did not get the mutex" ); | 279 CYG_TEST_CHECK( 1 == got_it, "Thread 1 did not get the mutex" ); |
| 257 #else | 280 #else |
| 258 CYG_TEST_INFO( "Checking for NO mutex_priority_inheritance" ); | 281 CYG_TEST_INFO( "Checking for NO mutex priority inheritance" ); |
| 259 CYG_TEST_CHECK( 0 == t3ran, "Thread 3 DID run" ); | 282 CYG_TEST_CHECK( 0 == t3ran, "Thread 3 DID run" ); |
| 260 CYG_TEST_CHECK( 0 == got_it, "Thread 1 DID get the mutex" ); | 283 CYG_TEST_CHECK( 0 == got_it, "Thread 1 DID get the mutex" ); |
| 261 #endif | 284 #endif |
| 262 | 285 |
| 263 CYG_TEST_CHECK( 0 == t3ended, "Thread 3 ended prematurely [T2,1]" ); | 286 CYG_TEST_CHECK( 0 == t3ended, "Thread 3 ended prematurely [T2,1]" ); |
| 334 int d = xx[j] | (xx[k]<<1) | (xx[l]<<2) ; | 357 int d = xx[j] | (xx[k]<<1) | (xx[l]<<2) ; |
| 335 | 358 |
| 336 if ( cyg_test_is_simulator && (0 != i && 13 != i && 26 != i) ) | 359 if ( cyg_test_is_simulator && (0 != i && 13 != i && 26 != i) ) |
| 337 continue; // 13 is 111 base 3, 26 is 222 base 3 | 360 continue; // 13 is 111 base 3, 26 is 222 base 3 |
| 338 | 361 |
| 339 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INHERITANCE | 362 #ifdef PRIORITY_INHERITANCE |
| 340 // If the simple scheme plus relay enhancement, or any other | 363 // If the simple scheme plus relay enhancement, or any other |
| 341 // *complete* scheme, we can run all three ancillary threads no | 364 // *complete* scheme, we can run all three ancillary threads no |
| 342 // problem, so no special action here. | 365 // problem, so no special action here. |
| 343 | |
| 344 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INHERITANCE_SIMPLE | |
| 345 #ifndef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INHERITANCE_SIMPLE_RELAY | |
| 346 // If the simple scheme but no relay enhancement: | |
| 347 if ( k ) // Cannot run thread 2a nor 3a | |
| 348 break; // if no priority relay. | |
| 349 #endif | |
| 350 #endif | |
| 351 | 366 |
| 352 #else | 367 #else |
| 353 // If no priority inheritance at all, running threads 1a and 2a is | 368 // If no priority inheritance at all, running threads 1a and 2a is |
| 354 // OK, but not thread 3a; it blocks the world. | 369 // OK, but not thread 3a; it blocks the world. |
| 355 if ( l ) // Cannot run thread 3a if no | 370 if ( l ) // Cannot run thread 3a if no |
