testglobalmutex.c (apr-1.6.5.tar.bz2) | : | testglobalmutex.c (apr-1.7.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 71 | skipping to change at line 71 | |||
/* return symbolic name for a locking meechanism */ | /* return symbolic name for a locking meechanism */ | |||
static const char *mutexname(apr_lockmech_e mech) | static const char *mutexname(apr_lockmech_e mech) | |||
{ | { | |||
switch (mech) { | switch (mech) { | |||
case APR_LOCK_FCNTL: return "fcntl"; | case APR_LOCK_FCNTL: return "fcntl"; | |||
case APR_LOCK_FLOCK: return "flock"; | case APR_LOCK_FLOCK: return "flock"; | |||
case APR_LOCK_SYSVSEM: return "sysvsem"; | case APR_LOCK_SYSVSEM: return "sysvsem"; | |||
case APR_LOCK_PROC_PTHREAD: return "proc_pthread"; | case APR_LOCK_PROC_PTHREAD: return "proc_pthread"; | |||
case APR_LOCK_POSIXSEM: return "posixsem"; | case APR_LOCK_POSIXSEM: return "posixsem"; | |||
case APR_LOCK_DEFAULT: return "default"; | case APR_LOCK_DEFAULT: return "default"; | |||
case APR_LOCK_DEFAULT_TIMED: return "default_timed"; | ||||
default: return "unknown"; | default: return "unknown"; | |||
} | } | |||
} | } | |||
static void test_exclusive(abts_case *tc, void *data) | static void test_exclusive(abts_case *tc, void *data) | |||
{ | { | |||
apr_lockmech_e mech = *(apr_lockmech_e *)data; | apr_lockmech_e mech = *(apr_lockmech_e *)data; | |||
apr_proc_t p1, p2, p3, p4; | apr_proc_t p1, p2, p3, p4; | |||
apr_status_t rv; | apr_status_t rv; | |||
apr_global_mutex_t *global_lock; | apr_global_mutex_t *global_lock; | |||
int x = 0; | int x = 0; | |||
abts_log_message("lock mechanism is: "); | abts_log_message("lock mechanism is: "); | |||
abts_log_message(mutexname(mech)); | abts_log_message(mutexname(mech)); | |||
rv = apr_global_mutex_create(&global_lock, LOCKNAME, mech, p); | rv = apr_global_mutex_create(&global_lock, LOCKNAME, mech, p); | |||
if (rv == APR_ENOTIMPL) { | ||||
/* MacOS lacks TIMED implementation, so don't fail for ENOTIMPL */ | ||||
ABTS_NOT_IMPL(tc, "global mutex TIMED not implemented"); | ||||
return; | ||||
} | ||||
APR_ASSERT_SUCCESS(tc, "Error creating mutex", rv); | APR_ASSERT_SUCCESS(tc, "Error creating mutex", rv); | |||
launch_child(tc, mech, &p1, p); | launch_child(tc, mech, &p1, p); | |||
launch_child(tc, mech, &p2, p); | launch_child(tc, mech, &p2, p); | |||
launch_child(tc, mech, &p3, p); | launch_child(tc, mech, &p3, p); | |||
launch_child(tc, mech, &p4, p); | launch_child(tc, mech, &p4, p); | |||
x += wait_child(tc, &p1); | x += wait_child(tc, &p1); | |||
x += wait_child(tc, &p2); | x += wait_child(tc, &p2); | |||
x += wait_child(tc, &p3); | x += wait_child(tc, &p3); | |||
skipping to change at line 132 | skipping to change at line 138 | |||
abts_run_test(suite, test_exclusive, &mech); | abts_run_test(suite, test_exclusive, &mech); | |||
#endif | #endif | |||
#if APR_HAS_FCNTL_SERIALIZE | #if APR_HAS_FCNTL_SERIALIZE | |||
mech = APR_LOCK_FCNTL; | mech = APR_LOCK_FCNTL; | |||
abts_run_test(suite, test_exclusive, &mech); | abts_run_test(suite, test_exclusive, &mech); | |||
#endif | #endif | |||
#if APR_HAS_FLOCK_SERIALIZE | #if APR_HAS_FLOCK_SERIALIZE | |||
mech = APR_LOCK_FLOCK; | mech = APR_LOCK_FLOCK; | |||
abts_run_test(suite, test_exclusive, &mech); | abts_run_test(suite, test_exclusive, &mech); | |||
#endif | #endif | |||
mech = APR_LOCK_DEFAULT_TIMED; | ||||
abts_run_test(suite, test_exclusive, &mech); | ||||
return suite; | return suite; | |||
} | } | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 8 lines changed or added |