Merge r6148:

Minor adjustments to the scheduler, mostly cosmetic.

- rename VG_(kill_thread) to VG_(get_thread_out_of_syscall), which
  is what it actually does.

- Remove 'semaphore' terminology in places and use 'lock' instead.

- Give an extra 'HChar* who' arg to VG_(set_running) and 
  VG_(set_sleeping), which is printed when --trace-sched=yes.
  This makes it easier to make sense of lock ownership changes
  from the debug output.

- various other improvements to debug printing

- add a kludge to encourage the AIX scheduler to switch threads
  more often when more than one is runnable (am not claiming to 
  understand this); otherwise CPU starvation can appear to happen

- more assertions in sema.c (the pipe-based lock); cycle the token
  through 'A' to 'Z' to make strace/truss output more understandable;
  fix longstanding bug wherein sema_down() tries to read two bytes
  even though sema_up only writes one.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6281 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/pub_core_scheduler.h b/coregrind/pub_core_scheduler.h
index b6a5c94..7e71513 100644
--- a/coregrind/pub_core_scheduler.h
+++ b/coregrind/pub_core_scheduler.h
@@ -43,31 +43,31 @@
 /* A thread exits.  tid must currently be running. */
 extern void VG_(exit_thread)(ThreadId tid);
 
-/* Kill a thread.  This interrupts whatever a thread is doing, and
-   makes it exit ASAP.  This does not set the exitreason or
-   exitcode. */
-extern void VG_(kill_thread)(ThreadId tid);
+/* If 'tid' is blocked in a syscall, send it SIGVGKILL so as to get it
+   out of the syscall and onto doing the next thing, whatever that is.
+   If it isn't blocked in a syscall, has no effect on the thread. */
+extern void VG_(get_thread_out_of_syscall)(ThreadId tid);
 
 /* Nuke all threads except tid. */
 extern void VG_(nuke_all_threads_except) ( ThreadId me,
                                            VgSchedReturnCode reason );
 
 /* Make a thread the running thread.  The thread must previously been
-   sleeping, and not holding the CPU semaphore. This will set the
+   sleeping, and not holding the CPU lock.  This will set the
    thread state to VgTs_Runnable, and the thread will attempt to take
-   the CPU semaphore.  By the time it returns, tid will be the running
+   the CPU lock.  By the time it returns, tid will be the running
    thread. */
-extern void VG_(set_running) ( ThreadId tid );
+extern void VG_(set_running) ( ThreadId tid, HChar* who );
 
 /* Set a thread into a sleeping state.  Before the call, the thread
-   must be runnable, and holding the CPU semaphore.  When this call
+   must be runnable, and holding the CPU lock.  When this call
    returns, the thread will be set to the specified sleeping state,
-   and will not be holding the CPU semaphore.  Note that another
+   and will not be holding the CPU lock.  Note that another
    thread could be running by the time this call returns, so the
    caller must be careful not to touch any shared state.  It is also
    the caller's responsibility to actually block until the thread is
    ready to run again. */
-extern void VG_(set_sleeping) ( ThreadId tid, ThreadStatus state );
+extern void VG_(set_sleeping) ( ThreadId tid, ThreadStatus state, HChar* who );
 
 /* Yield the CPU for a while */
 extern void VG_(vg_yield)(void);