equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
51 |
51 |
52 volatile int ParkEvent::ListLock = 0 ; |
52 volatile int ParkEvent::ListLock = 0 ; |
53 ParkEvent * volatile ParkEvent::FreeList = NULL ; |
53 ParkEvent * volatile ParkEvent::FreeList = NULL ; |
54 |
54 |
55 ParkEvent * ParkEvent::Allocate (Thread * t) { |
55 ParkEvent * ParkEvent::Allocate (Thread * t) { |
56 // In rare cases -- JVM_RawMonitor* operations -- we can find t == null. |
|
57 ParkEvent * ev ; |
56 ParkEvent * ev ; |
58 |
57 |
59 // Start by trying to recycle an existing but unassociated |
58 // Start by trying to recycle an existing but unassociated |
60 // ParkEvent from the global free list. |
59 // ParkEvent from the global free list. |
61 // Using a spin lock since we are part of the mutex impl. |
60 // Using a spin lock since we are part of the mutex impl. |
162 p->FreeNext = FreeList; |
161 p->FreeNext = FreeList; |
163 FreeList = p; |
162 FreeList = p; |
164 } |
163 } |
165 Thread::SpinRelease(&ListLock); |
164 Thread::SpinRelease(&ListLock); |
166 } |
165 } |
167 |
|