Added intercept for pthread_cancel().

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8640 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c
index 064804e..e722379 100644
--- a/drd/drd_pthread_intercepts.c
+++ b/drd/drd_pthread_intercepts.c
@@ -126,7 +126,10 @@
   return mutex_type_invalid_mutex;
 }
 
-static MutexT mutex_type(pthread_mutex_t* mutex)
+/** @note The function mutex_type() has been declared inline in order
+ *  to avoid that it shows up in call stacks.
+ */
+static __inline__ MutexT mutex_type(pthread_mutex_t* mutex)
 {
 #if defined(HAVE_PTHREAD_MUTEX_T__M_KIND)
   /* LinuxThreads. */
@@ -344,6 +347,21 @@
   return ret;
 }
 
+// pthread_cancel
+PTH_FUNC(int, pthreadZucancel, pthread_t pt_thread)
+{
+  int res;
+  int ret;
+  OrigFn fn;
+  VALGRIND_GET_ORIG_FN(fn);
+  VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_THREAD_CANCEL,
+                             pt_thread, 0, 0, 0, 0);
+  CALL_FN_W_W(ret, fn, pt_thread);
+  VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_THREAD_CANCEL,
+                             pt_thread, ret==0, 0, 0, 0);
+  return ret;
+}
+
 // pthread_mutex_init
 PTH_FUNC(int, pthreadZumutexZuinit,
          pthread_mutex_t *mutex,