|
From: <sv...@va...> - 2009-02-14 13:30:58
|
Author: bart
Date: 2009-02-14 12:14:50 +0000 (Sat, 14 Feb 2009)
New Revision: 9150
Log:
Added DRD_(spinlock_init_or_unlock)().
Modified:
trunk/drd/drd_mutex.c
trunk/drd/drd_mutex.h
Modified: trunk/drd/drd_mutex.c
===================================================================
--- trunk/drd/drd_mutex.c 2009-02-14 12:12:57 UTC (rev 9149)
+++ trunk/drd/drd_mutex.c 2009-02-14 12:14:50 UTC (rev 9150)
@@ -1,8 +1,7 @@
/*
This file is part of drd, a data race detector.
- Copyright (C) 2006-2008 Bart Van Assche
- bar...@gm...
+ Copyright (C) 2006-2009 Bart Van Assche <bar...@gm...>.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -23,6 +22,7 @@
*/
+#include "drd_basics.h"
#include "drd_clientobj.h"
#include "drd_error.h"
#include "drd_mutex.h"
@@ -425,6 +425,19 @@
}
}
+void DRD_(spinlock_init_or_unlock)(const Addr spinlock)
+{
+ struct mutex_info* mutex_p = mutex_get(spinlock);
+ if (mutex_p)
+ {
+ mutex_unlock(spinlock, mutex_type_spinlock);
+ }
+ else
+ {
+ mutex_init(spinlock, mutex_type_spinlock);
+ }
+}
+
const char* mutex_get_typename(struct mutex_info* const p)
{
tl_assert(p);
Modified: trunk/drd/drd_mutex.h
===================================================================
--- trunk/drd/drd_mutex.h 2009-02-14 12:12:57 UTC (rev 9149)
+++ trunk/drd/drd_mutex.h 2009-02-14 12:14:50 UTC (rev 9150)
@@ -48,6 +48,7 @@
void mutex_post_lock(const Addr mutex, const Bool took_lock,
const Bool post_cond_wait);
void mutex_unlock(const Addr mutex, const MutexT mutex_type);
+void DRD_(spinlock_init_or_unlock)(const Addr spinlock);
const char* mutex_get_typename(struct mutex_info* const p);
const char* mutex_type_name(const MutexT mt);
Bool mutex_is_locked_by(const Addr mutex, const DrdThreadId tid);
|