equal
deleted
inserted
replaced
1 |
1 |
2 /* |
2 /* |
3 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. |
8 * published by the Free Software Foundation. |
1294 Monitor* locks = get_least_ranked_lock(new_owner->owned_locks()); |
1294 Monitor* locks = get_least_ranked_lock(new_owner->owned_locks()); |
1295 // Mutex::set_owner_implementation is a friend of Thread |
1295 // Mutex::set_owner_implementation is a friend of Thread |
1296 |
1296 |
1297 assert(this->rank() >= 0, "bad lock rank"); |
1297 assert(this->rank() >= 0, "bad lock rank"); |
1298 |
1298 |
1299 if (LogMultipleMutexLocking && locks != NULL) { |
|
1300 Events::log("thread " INTPTR_FORMAT " locks %s, already owns %s", new_owner, name(), locks->name()); |
|
1301 } |
|
1302 |
|
1303 // Deadlock avoidance rules require us to acquire Mutexes only in |
1299 // Deadlock avoidance rules require us to acquire Mutexes only in |
1304 // a global total order. For example m1 is the lowest ranked mutex |
1300 // a global total order. For example m1 is the lowest ranked mutex |
1305 // that the thread holds and m2 is the mutex the thread is trying |
1301 // that the thread holds and m2 is the mutex the thread is trying |
1306 // to acquire, then deadlock avoidance rules require that the rank |
1302 // to acquire, then deadlock avoidance rules require that the rank |
1307 // of m2 be less than the rank of m1. |
1303 // of m2 be less than the rank of m1. |
1341 _owner = NULL; // set the owner |
1337 _owner = NULL; // set the owner |
1342 |
1338 |
1343 #ifdef ASSERT |
1339 #ifdef ASSERT |
1344 Monitor *locks = old_owner->owned_locks(); |
1340 Monitor *locks = old_owner->owned_locks(); |
1345 |
1341 |
1346 if (LogMultipleMutexLocking && locks != this) { |
|
1347 Events::log("thread " INTPTR_FORMAT " unlocks %s, still owns %s", old_owner, this->name(), locks->name()); |
|
1348 } |
|
1349 |
|
1350 // remove "this" from the owned locks list |
1342 // remove "this" from the owned locks list |
1351 |
1343 |
1352 Monitor *prev = NULL; |
1344 Monitor *prev = NULL; |
1353 bool found = false; |
1345 bool found = false; |
1354 for (; locks != NULL; prev = locks, locks = locks->next()) { |
1346 for (; locks != NULL; prev = locks, locks = locks->next()) { |