20 #ifndef PAGESPEED_KERNEL_UTIL_LOCK_MANAGER_SPAMMER_H_
21 #define PAGESPEED_KERNEL_UTIL_LOCK_MANAGER_SPAMMER_H_
31 #include "pagespeed/kernel/base/thread_annotations.h"
35 namespace net_instaweb {
37 class ThreadSafeLockManager;
49 static void RunTests(
int num_threads,
int num_iters,
int num_names,
50 bool expecting_denials,
bool delay_unlocks,
65 CountDown(
Scheduler* scheduler,
int initial_value);
69 void RunAlarmsTillThreadsComplete();
73 int value_ GUARDED_BY(scheduler_->mutex());
76 typedef std::vector<NamedLock*> LockVector;
79 ThreadSystem::ThreadFlags flags,
80 const StringVector& lock_names,
82 bool expecting_denials,
87 CountDown* pending_threads);
90 const StringVector& lock_names_;
92 bool expecting_denials_;
99 int grants_ GUARDED_BY(mutex_);
100 int denials_ GUARDED_BY(mutex_);
101 LockVector queued_unlocks_ GUARDED_BY(mutex_);
102 CountDown* pending_threads_;
void Granted(NamedLock *lock)
Called when a lock is granted/denied.
Non-blocking locking class.
Definition: named_lock_manager.h:31
static void RunTests(int num_threads, int num_iters, int num_names, bool expecting_denials, bool delay_unlocks, ThreadSafeLockManager *lock_manager, Scheduler *scheduler)
Definition: scoped_ptr.h:30
Definition: lock_manager_spammer.h:41
Threadsafe wrapper for a non-threadsafe lock manager: MemLockManager.
Definition: threadsafe_lock_manager.h:30
Definition: scheduler.h:47
Base class for client thread code.
Definition: thread.h:34