Lines Matching defs:thread
91 // FIXME put referencing ThreadId into Thread and get
99 // the thread still holds the lock.
117 // FIXME: don't hardwire initial entries for root thread.
126 static Thread* admin_threads = NULL;
127 Thread* get_admin_threads ( void ) { return admin_threads; }
134 /* Mapping table for core ThreadIds to Thread* */
135 static Thread** map_threads = NULL; /* Array[VG_N_THREADS] of Thread* */
164 ThreadId map_threads_maybe_reverse_lookup_SLOW ( Thread* thr ); /*fwds*/
168 static Thread* mk_Thread ( Thr* hbthr ) {
170 Thread* thread = HG_(zalloc)( "hg.mk_Thread.1", sizeof(Thread) );
171 thread->locksetA = HG_(emptyWS)( univ_lsets );
172 thread->locksetW = HG_(emptyWS)( univ_lsets );
173 thread->magic = Thread_MAGIC;
174 thread->hbthr = hbthr;
175 thread->coretid = VG_INVALID_THREADID;
176 thread->created_at = NULL;
177 thread->announced = False;
178 thread->errmsg_index = indx++;
179 thread->admin = admin_threads;
180 admin_threads = thread;
181 return thread;
239 static void lockN_acquire_writer ( Lock* lk, Thread* thr )
274 /* assert: lk is only held by one thread .. */
276 /* assert: .. and that thread is 'thr'. */
290 static void lockN_acquire_reader ( Lock* lk, Thread* thr )
331 static void lockN_release ( Lock* lk, Thread* thr )
356 Thread* thr;
361 /* for each thread that holds this lock do ... */
406 static void pp_Thread ( Int d, Thread* t )
408 space(d+0); VG_(printf)("Thread %p {\n", t);
421 Thread* t;
449 VG_(printf)("coretid %d -> Thread %p\n", i, map_threads[i]);
497 Thread* thr;
505 VG_(printf)("%c%lu:thread #%d ",
589 Thread* thr;
597 map_threads = HG_(zalloc)( "hg.ids.1", VG_N_THREADS * sizeof(Thread*) );
623 /* Set up entries for the root thread */
626 /* a Thread for the new thread ... */
629 identity of the root thread. */
633 /* and bind it in the thread-map table. */
646 /*--- map_threads :: array[core-ThreadId] of Thread* ---*/
650 static Thread* map_threads_maybe_lookup ( ThreadId coretid )
652 Thread* thr;
659 static inline Thread* map_threads_lookup ( ThreadId coretid )
661 Thread* thr;
670 static ThreadId map_threads_maybe_reverse_lookup_SLOW ( Thread* thr )
684 static ThreadId map_threads_reverse_lookup_SLOW ( Thread* thr )
695 Thread* thr;
768 Thread vs Segment/Lock/SecMaps
772 // Thread.lockset: each element is really a valid Lock
774 // Thread.lockset: each Lock in set is actually held by that thread
775 for lk in Thread.lockset
778 // Thread.csegid is a valid SegmentID
783 all thread Locksets are pairwise empty under intersection
784 (that is, no lock is claimed to be held by more than one thread)
788 Lock vs Thread/Segment/SecMaps
807 Segment vs Thread/Lock/SecMaps
815 seg->thr is a sane Thread
819 SecMaps vs Segment/Thread/Lock
830 each thr in tset is a valid thread, which is non-dead
837 static Bool thread_is_a_holder_of_Lock ( Thread* thr, Lock* lk )
851 Thread* thr;
865 // Thread.lockset: each element is really a valid Lock
867 // Thread.lockset: each Lock in set is actually held by that
868 // thread
911 Thread* thr;
963 static void laog__pre_thread_acquires_lock ( Thread*, Lock* ); /* fwds */
965 static inline Thread* get_current_Thread ( void ); /* fwds */
973 static void shadow_mem_scopy_range ( Thread* thr,
981 static void shadow_mem_cread_range ( Thread* thr, Addr a, SizeT len )
988 static void shadow_mem_cwrite_range ( Thread* thr, Addr a, SizeT len ) {
994 static void shadow_mem_make_New ( Thread* thr, Addr a, SizeT len )
999 static void shadow_mem_make_NoAccess_NoFX ( Thread* thr, Addr aIN, SizeT len )
1007 static void shadow_mem_make_NoAccess_AHAE ( Thread* thr, Addr aIN, SizeT len )
1015 static void shadow_mem_make_Untracked ( Thread* thr, Addr aIN, SizeT len )
1037 //zz Thread* thr )
1046 //zz at their owner thread. */
1057 void evhH__post_thread_w_acquires_lock ( Thread* thr,
1104 thread, then libpthread must be buggy. */
1107 if (thr != (Thread*)VG_(anyElementOfBag)(lk->heldBy)) {
1111 "wr-held by a different thread");
1138 happen before the lock is added to the thread's locksetA/W. */
1141 /* update the thread's held-locks set */
1154 void evhH__post_thread_r_acquires_lock ( Thread* thr,
1213 happen before the lock is added to the thread's locksetA/W. */
1216 /* update the thread's held-locks set */
1229 void evhH__pre_thread_releases_lock ( Thread* thr,
1282 /* The lock is held. Is this thread one of the holders? If not,
1291 Thread* realOwner = (Thread*)VG_(anyElementOfBag)( lock->heldBy );
1330 can't be w-held by more than one thread. */
1347 /* update this thread's lockset accordingly. */
1370 /* What is the Thread* for the currently running thread? This is
1374 finding the current thread reduces to a read of a global variable,
1386 static Thread *current_Thread = NULL,
1405 static inline Thread* get_current_Thread_in_C_C ( void ) {
1408 static inline Thread* get_current_Thread ( void ) {
1410 Thread* thr;
1536 Thread* thr_p;
1537 Thread* thr_c;
1557 /* Create a new thread record for the child. */
1558 /* a Thread for the new thread ... */
1563 /* and bind it in the thread-map table */
1595 Thread* thr_q;
1600 /* quit_tid has disappeared without joining to any other thread.
1605 is a point in time when we're sure the thread really has
1609 /* However, it might have rendezvous'd with a thread that called
1612 sync event. So in any case, just let the thread exit. On NPTL,
1613 all thread exits go through here. */
1618 /* Complain if this thread holds any locks. */
1623 VG_(sprintf)(buf, "Exiting thread still holds %d lock%s",
1629 - tell libhb the thread is gone
1645 is the only surviving thread (as per POSIX rules on fork() in
1652 Thread* thr;
1675 void evh__HG_PTHREAD_JOIN_POST ( ThreadId stay_tid, Thread* quit_thr )
1677 Thread* thr_s;
1678 Thread* thr_q;
1707 /* Send last arg of _so_send as False, since the sending thread
1717 buggy (calls pthread_join twice or more on the same thread) AND
1726 thread holds any locks. No need to check here. */
1728 /* This holds because, at least when using NPTL as the thread
1729 library, we should be notified the low level thread exit before
1800 Thread* thr;
1808 where memory is referenced by one thread, and freed by
1822 Thread* thr = get_current_Thread_in_C_C();
1829 Thread* thr = get_current_Thread_in_C_C();
1836 Thread* thr = get_current_Thread_in_C_C();
1843 Thread* thr = get_current_Thread_in_C_C();
1850 Thread* thr = get_current_Thread_in_C_C();
1857 Thread* thr = get_current_Thread_in_C_C();
1864 Thread* thr = get_current_Thread_in_C_C();
1871 Thread* thr = get_current_Thread_in_C_C();
1878 Thread* thr = get_current_Thread_in_C_C();
1885 Thread* thr = get_current_Thread_in_C_C();
1917 Thread* thr;
1925 /* cannot fail - Thread* must already exist */
1976 Thread* thr;
1984 tl_assert(thr); /* cannot fail - Thread* must already exist */
2017 Thread* thr;
2023 tl_assert(thr); /* cannot fail - Thread* must already exist */
2035 Thread* thr;
2041 tl_assert(thr); /* cannot fail - Thread* must already exist */
2049 Thread* thr;
2054 tl_assert(thr); /* cannot fail - Thread* must already exist */
2070 Thread* thr;
2082 /* cannot fail - Thread* must already exist */;
2202 Thread* thr;
2206 tl_assert(thr); /* cannot fail - Thread* must already exist */
2243 SO. This is later used by other thread(s) which successfully
2247 Thread* thr;
2256 tl_assert(thr); /* cannot fail - Thread* must already exist */
2268 // held by any thread. Skip the "dubious" if it is held by some
2269 // other thread; that sounds straight-out wrong.
2275 // reason about. In particular it puts the signalling thread in
2296 "associated lock is not held by any thread");
2301 "associated lock is not held by calling thread");
2319 thread, else False */
2323 Thread* thr;
2334 tl_assert(thr); /* cannot fail - Thread* must already exist */
2364 "held by a different thread" );
2394 Thread* thr;
2403 tl_assert(thr); /* cannot fail - Thread* must already exist */
2410 that did an error (e.g. cond var was destroyed by another thread.
2487 Thread* thr;
2494 /* cannot fail - Thread* must already exist */
2538 Thread* thr;
2547 tl_assert(thr); /* cannot fail - Thread* must already exist */
2563 Thread* thr;
2570 tl_assert(thr); /* cannot fail - Thread* must already exist */
2583 Thread* thr;
2589 tl_assert(thr); /* cannot fail - Thread* must already exist */
2597 Thread* thr;
2602 tl_assert(thr); /* cannot fail - Thread* must already exist */
2617 is created for the posting thread, the posting thread does a strong
2618 send to it (which merely installs the posting thread's VC in the
2621 Later, when a (probably different) thread completes 'wait' on the
2729 Thread* thr;
2736 tl_assert(thr); /* cannot fail - Thread* must already exist */
2754 /* Now create 'valid' new SOs for the thread, do a strong send to
2771 by other thread(s) which successfully exit from a sem_wait on
2773 stack, they acquire dependencies on the posting thread
2776 Thread* thr;
2785 tl_assert(thr); /* cannot fail - Thread* must already exist */
2804 Thread* thr;
2813 tl_assert(thr); /* cannot fail - Thread* must already exist */
2845 XArray* waiting; /* XA of Thread*. # present is 0 .. .size */
2906 Thread* thr;
2915 tl_assert(thr); /* cannot fail - Thread* must already exist */
2947 sizeof(Thread*) );
2961 Thread* thr;
2973 tl_assert(thr); /* cannot fail - Thread* must already exist */
3019 Thread* t = *(Thread**)VG_(indexXA)(bar->waiting, i);
3025 Thread* t = *(Thread**)VG_(indexXA)(bar->waiting, i);
3042 /* This function gets called after a client thread calls
3048 If this is not the last thread arriving at the barrier, we simply
3054 If this is the last thread, then we are again the only running
3055 thread. All the other threads will have either arrived at the
3058 thread is currently in this function and so has not yet arrived
3065 this thread and all other waiting threads will be able to move
3082 Thread* thr;
3092 tl_assert(thr); /* cannot fail - Thread* must already exist */
3125 Thread* thr;
3135 tl_assert(thr); /* cannot fail - Thread* must already exist */
3241 clocks from this thread into any vector clocks already present
3243 other thread(s) which successfully 'receive' from the SO,
3246 Thread* thr;
3254 tl_assert(thr); /* cannot fail - Thread* must already exist */
3271 Thread* thr;
3279 tl_assert(thr); /* cannot fail - Thread* must already exist */
3316 The common case is that some thread T holds (eg) L1 L2 and L3 and
3749 /* Thread 'thr' is acquiring 'lk'. Check for inconsistent ordering
3755 Thread* thr, /* NB: BEFORE lock is added */
3834 taken by a thread and all the already taken locks.
3835 So, there is no laog_exposition (fCA, fBC) as no thread ever
3845 held by this thread, with its 'acquired_at'. */
3867 acquired by a thread, and we're in an inconsistent state here.
3976 Thread* thr; /* allocating thread */
4733 static WordFM* map_pthread_t_to_Thread = NULL; /* pthread_t -> Thread* */
4874 /* Some thread is telling us its pthread_t value. Record the
4875 binding between that and the associated Thread*, so we can
4876 later find the Thread* again when notified of a join by the
4877 thread. */
4879 Thread* my_thr = NULL;
4886 Thread*) binding should have been made at the point of
4887 low-level creation of this thread, which should have
4891 only runs once the thread has been low-level created. */
4894 (Thread*)my_thr. Note that down. */
4896 VG_(printf)("XXXX: bind pthread_t %p to Thread* %p\n",
4903 Thread* my_thr = NULL;
4912 /* This thread (tid) has completed a join with the quitting
4913 thread whose pthread_t is in args[1]. */
4915 Thread* thr_q = NULL; /* quitter Thread* */
4925 thread never existed (or at least, it never lodged an
4932 VG_(printf)(".................... quitter Thread* = %p\n",
4969 /* This thread is about to do pthread_cond_signal on the
4987 /* Thread successfully completed pthread_cond_init:
4999 /* Thread successfully completed pthread_cond_wait, cond=arg[1],
5101 Thread* thr = map_threads_maybe_lookup( tid );
5217 " approx: full trace for one thread, approx for the other (faster)\n"
5218 " none: only show trace for one thread in a race (fastest)\n"
5221 " main stack and thread stacks? [yes]\n"
5238 VG_(printf)(" 000001 at thread create/join events\n");
5338 Thread* thr;
5355 Thread* thr;
5393 VG_(details_description) ("a thread error detector");
5455 // FIXME: surely this isn't thread-aware