Skip to content

Commit 35ab558

Browse files
committed
---
yaml --- r: 11962 b: refs/heads/master c: b247de6 h: refs/heads/master v: v3
1 parent a006a42 commit 35ab558

File tree

10 files changed

+1
-76
lines changed

10 files changed

+1
-76
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: e4af1ca0657d2b3b4fc2e7829cd8f822d983de1b
2+
refs/heads/master: b247de64583e2ab527088813ba9192824554e801
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/etc/x86.supp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -389,34 +389,6 @@
389389
fun:uv_loop_delete
390390
}
391391

392-
{
393-
lock_and_signal-probably-threadsafe-access-outside-of-lock
394-
Helgrind:Race
395-
fun:_ZN15lock_and_signal27lock_held_by_current_threadEv
396-
...
397-
}
398-
399-
{
400-
lock_and_signal-probably-threadsafe-access-outside-of-lock2
401-
Helgrind:Race
402-
fun:_ZN15lock_and_signal6unlockEv
403-
...
404-
}
405-
406-
{
407-
lock_and_signal-probably-threadsafe-access-outside-of-lock3
408-
Helgrind:Race
409-
fun:_ZN15lock_and_signal4lockEv
410-
...
411-
}
412-
413-
{
414-
lock_and_signal-probably-threadsafe-access-outside-of-lock4
415-
Helgrind:Race
416-
fun:_ZN15lock_and_signal4waitEv
417-
...
418-
}
419-
420392
{
421393
uv-async-send-does-racy-things
422394
Helgrind:Race

trunk/src/rt/rust_kernel.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ void rust_kernel::free(void *mem) {
6262

6363
rust_sched_id
6464
rust_kernel::create_scheduler(size_t num_threads) {
65-
I(this, !sched_lock.lock_held_by_current_thread());
6665
rust_sched_id id;
6766
rust_scheduler *sched;
6867
{
@@ -81,7 +80,6 @@ rust_kernel::create_scheduler(size_t num_threads) {
8180

8281
rust_scheduler *
8382
rust_kernel::get_scheduler_by_id(rust_sched_id id) {
84-
I(this, !sched_lock.lock_held_by_current_thread());
8583
scoped_lock with(sched_lock);
8684
sched_map::iterator iter = sched_table.find(id);
8785
if (iter != sched_table.end()) {
@@ -93,7 +91,6 @@ rust_kernel::get_scheduler_by_id(rust_sched_id id) {
9391

9492
void
9593
rust_kernel::release_scheduler_id(rust_sched_id id) {
96-
I(this, !sched_lock.lock_held_by_current_thread());
9794
scoped_lock with(sched_lock);
9895
// This list will most likely only ever have a single element in it, but
9996
// it's an actual list because we could potentially get here multiple
@@ -111,7 +108,6 @@ them then we can see valgrind errors due to un-freed pthread memory.
111108
int
112109
rust_kernel::wait_for_schedulers()
113110
{
114-
I(this, !sched_lock.lock_held_by_current_thread());
115111
scoped_lock with(sched_lock);
116112
while (!sched_table.empty()) {
117113
while (!join_list.empty()) {

trunk/src/rt/rust_port.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ void rust_port::end_detach() {
5555
}
5656

5757
void rust_port::send(void *sptr) {
58-
I(task->thread, !lock.lock_held_by_current_thread());
5958
bool did_rendezvous = false;
6059
{
6160
scoped_lock with(lock);
@@ -88,8 +87,6 @@ void rust_port::send(void *sptr) {
8887
}
8988

9089
void rust_port::receive(void *dptr, uintptr_t *yield) {
91-
I(task->thread, !lock.lock_held_by_current_thread());
92-
9390
LOG(task, comm, "port: 0x%" PRIxPTR ", dptr: 0x%" PRIxPTR
9491
", size: 0x%" PRIxPTR,
9592
(uintptr_t) this, (uintptr_t) dptr, unit_sz);
@@ -122,7 +119,6 @@ void rust_port::receive(void *dptr, uintptr_t *yield) {
122119
}
123120

124121
size_t rust_port::size() {
125-
I(task->thread, !lock.lock_held_by_current_thread());
126122
scoped_lock with(lock);
127123
return buffer.size();
128124
}

trunk/src/rt/rust_port_selector.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ void
6969
rust_port_selector::msg_sent_on(rust_port *port) {
7070
rust_task *task = port->task;
7171

72-
I(task->thread, !port->lock.lock_held_by_current_thread());
73-
I(task->thread, !rendezvous_lock.lock_held_by_current_thread());
74-
7572
// Prevent two ports from trying to wake up the task
7673
// simultaneously
7774
scoped_lock with(rendezvous_lock);

trunk/src/rt/rust_scheduler.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ rust_scheduler::number_of_threads() {
133133

134134
void
135135
rust_scheduler::release_task_thread() {
136-
I(this, !lock.lock_held_by_current_thread());
137136
uintptr_t new_live_threads;
138137
{
139138
scoped_lock with(lock);

trunk/src/rt/rust_task.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ rust_task::must_fail_from_being_killed() {
242242

243243
bool
244244
rust_task::must_fail_from_being_killed_unlocked() {
245-
I(thread, kill_lock.lock_held_by_current_thread());
246245
return killed && !reentered_rust_stack;
247246
}
248247

trunk/src/rt/rust_task_thread.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ rust_task_thread::number_of_live_tasks() {
121121
*/
122122
void
123123
rust_task_thread::reap_dead_tasks() {
124-
I(this, lock.lock_held_by_current_thread());
125-
126124
if (dead_tasks.length() == 0) {
127125
return;
128126
}
@@ -358,7 +356,6 @@ rust_task_thread::place_task_in_tls(rust_task *task) {
358356

359357
void
360358
rust_task_thread::exit() {
361-
A(this, !lock.lock_held_by_current_thread(), "Shouldn't have lock");
362359
scoped_lock with(lock);
363360
should_exit = true;
364361
lock.signal();

trunk/src/rt/sync/lock_and_signal.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@
1010

1111
#include "lock_and_signal.h"
1212

13-
// FIXME: This is not a portable way of specifying an invalid pthread_t
14-
#define INVALID_THREAD 0
15-
16-
1713
#if defined(__WIN32__)
1814
lock_and_signal::lock_and_signal()
19-
: _holding_thread(INVALID_THREAD)
2015
{
2116
_event = CreateEvent(NULL, FALSE, FALSE, NULL);
2217

@@ -35,7 +30,6 @@ lock_and_signal::lock_and_signal()
3530

3631
#else
3732
lock_and_signal::lock_and_signal()
38-
: _holding_thread(INVALID_THREAD)
3933
{
4034
CHECKED(pthread_cond_init(&_cond, NULL));
4135
CHECKED(pthread_mutex_init(&_mutex, NULL));
@@ -53,19 +47,14 @@ lock_and_signal::~lock_and_signal() {
5347
}
5448

5549
void lock_and_signal::lock() {
56-
assert(!lock_held_by_current_thread());
5750
#if defined(__WIN32__)
5851
EnterCriticalSection(&_cs);
59-
_holding_thread = GetCurrentThreadId();
6052
#else
6153
CHECKED(pthread_mutex_lock(&_mutex));
62-
_holding_thread = pthread_self();
6354
#endif
6455
}
6556

6657
void lock_and_signal::unlock() {
67-
assert(lock_held_by_current_thread());
68-
_holding_thread = INVALID_THREAD;
6958
#if defined(__WIN32__)
7059
LeaveCriticalSection(&_cs);
7160
#else
@@ -77,18 +66,12 @@ void lock_and_signal::unlock() {
7766
* Wait indefinitely until condition is signaled.
7867
*/
7968
void lock_and_signal::wait() {
80-
assert(lock_held_by_current_thread());
81-
_holding_thread = INVALID_THREAD;
8269
#if defined(__WIN32__)
8370
LeaveCriticalSection(&_cs);
8471
WaitForSingleObject(_event, INFINITE);
8572
EnterCriticalSection(&_cs);
86-
assert(_holding_thread == INVALID_THREAD);
87-
_holding_thread = GetCurrentThreadId();
8873
#else
8974
CHECKED(pthread_cond_wait(&_cond, &_mutex));
90-
assert(_holding_thread == INVALID_THREAD);
91-
_holding_thread = pthread_self();
9275
#endif
9376
}
9477

@@ -103,15 +86,6 @@ void lock_and_signal::signal() {
10386
#endif
10487
}
10588

106-
bool lock_and_signal::lock_held_by_current_thread()
107-
{
108-
#if defined(__WIN32__)
109-
return _holding_thread == GetCurrentThreadId();
110-
#else
111-
return pthread_equal(_holding_thread, pthread_self());
112-
#endif
113-
}
114-
11589
scoped_lock::scoped_lock(lock_and_signal &lock)
11690
: lock(lock)
11791
{

trunk/src/rt/sync/lock_and_signal.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@ class lock_and_signal {
66
#if defined(__WIN32__)
77
HANDLE _event;
88
CRITICAL_SECTION _cs;
9-
DWORD _holding_thread;
109
#else
1110
pthread_cond_t _cond;
1211
pthread_mutex_t _mutex;
13-
14-
pthread_t _holding_thread;
1512
#endif
1613

1714
public:
@@ -22,8 +19,6 @@ class lock_and_signal {
2219
void unlock();
2320
void wait();
2421
void signal();
25-
26-
bool lock_held_by_current_thread();
2722
};
2823

2924
class scoped_lock {

0 commit comments

Comments
 (0)