summaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-14 05:16:18 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-14 05:16:18 +0000
commita49351f9a8e5bd1f4dddf1f60156565d37f9e01d (patch)
tree0663c9cf06648a1067ddd04373651e98c79fa524 /libgo
parent6251089358901193c509f0c44b2f47165f788104 (diff)
downloadgcc-a49351f9a8e5bd1f4dddf1f60156565d37f9e01d.tar.gz
Release cache while holding thread lock.
Don't bother to hold thread lock while allocating cache. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167784 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r--libgo/runtime/go-go.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libgo/runtime/go-go.c b/libgo/runtime/go-go.c
index a97b7af9592..55aa3e36fb9 100644
--- a/libgo/runtime/go-go.c
+++ b/libgo/runtime/go-go.c
@@ -107,11 +107,11 @@ remove_current_thread (void)
if (list_entry->next != NULL)
list_entry->next->prev = list_entry->prev;
+ runtime_MCache_ReleaseAll (mcache);
+
i = pthread_mutex_unlock (&__go_thread_ids_lock);
__go_assert (i == 0);
- runtime_MCache_ReleaseAll (mcache);
-
runtime_lock (&runtime_mheap);
mstats.heap_alloc += mcache->local_alloc;
mstats.heap_objects += mcache->local_objects;
@@ -225,14 +225,13 @@ __go_go (void (*pfn) (void*), void *arg)
newm->list_entry = list_entry;
+ newm->mcache = runtime_allocmcache ();
+
/* Add the thread to the list of all threads, marked as tentative
since it is not yet ready to go. */
i = pthread_mutex_lock (&__go_thread_ids_lock);
__go_assert (i == 0);
- /* We use __go_thread_ids_lock as a lock for mheap.cachealloc. */
- newm->mcache = runtime_allocmcache ();
-
if (__go_all_thread_ids != NULL)
__go_all_thread_ids->prev = list_entry;
list_entry->next = __go_all_thread_ids;