sanitizer_stoptheworld.h [plain text]
#ifndef SANITIZER_STOPTHEWORLD_H
#define SANITIZER_STOPTHEWORLD_H
#include "sanitizer_internal_defs.h"
#include "sanitizer_common.h"
namespace __sanitizer {
typedef int SuspendedThreadID;
class SuspendedThreadsList {
public:
SuspendedThreadsList()
: thread_ids_(1024) {}
SuspendedThreadID GetThreadID(uptr index) const {
CHECK_LT(index, thread_ids_.size());
return thread_ids_[index];
}
int GetRegistersAndSP(uptr index, uptr *buffer, uptr *sp) const;
static uptr RegisterCount();
uptr thread_count() const { return thread_ids_.size(); }
bool Contains(SuspendedThreadID thread_id) const {
for (uptr i = 0; i < thread_ids_.size(); i++) {
if (thread_ids_[i] == thread_id)
return true;
}
return false;
}
void Append(SuspendedThreadID thread_id) {
thread_ids_.push_back(thread_id);
}
private:
InternalMmapVector<SuspendedThreadID> thread_ids_;
SuspendedThreadsList(const SuspendedThreadsList&);
void operator=(const SuspendedThreadsList&);
};
typedef void (*StopTheWorldCallback)(
const SuspendedThreadsList &suspended_threads_list,
void *argument);
void StopTheWorld(StopTheWorldCallback callback, void *argument);
}
#endif // SANITIZER_STOPTHEWORLD_H