projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
52589e0
)
Add closeMutex and use it on clean up
author
Esa Ilari Vuokko
<ei@vuokko.info>
Wed, 23 Aug 2006 19:46:04 +0000
(19:46 +0000)
committer
Esa Ilari Vuokko
<ei@vuokko.info>
Wed, 23 Aug 2006 19:46:04 +0000
(19:46 +0000)
includes/OSThreads.h
patch
|
blob
|
history
rts/Capability.c
patch
|
blob
|
history
rts/Schedule.c
patch
|
blob
|
history
rts/Stable.c
patch
|
blob
|
history
rts/Storage.c
patch
|
blob
|
history
rts/Task.c
patch
|
blob
|
history
rts/Typeable.c
patch
|
blob
|
history
rts/posix/OSThreads.c
patch
|
blob
|
history
rts/win32/OSThreads.c
patch
|
blob
|
history
diff --git
a/includes/OSThreads.h
b/includes/OSThreads.h
index
9043144
..
32f147a
100644
(file)
--- a/
includes/OSThreads.h
+++ b/
includes/OSThreads.h
@@
-161,6
+161,7
@@
extern rtsBool waitCondition ( Condition* pCond,
// Mutexes
//
extern void initMutex ( Mutex* pMut );
// Mutexes
//
extern void initMutex ( Mutex* pMut );
+extern void closeMutex ( Mutex* pMut );
//
// Thread-local storage
//
// Thread-local storage
diff --git
a/rts/Capability.c
b/rts/Capability.c
index
2384262
..
e384e1e
100644
(file)
--- a/
rts/Capability.c
+++ b/
rts/Capability.c
@@
-671,6
+671,9
@@
shutdownCapability (Capability *cap, Task *task)
}
// we now have the Capability, its run queue and spare workers
// list are both empty.
}
// we now have the Capability, its run queue and spare workers
// list are both empty.
+
+ // We end up here only in THREADED_RTS
+ closeMutex(&cap->lock);
}
/* ----------------------------------------------------------------------------
}
/* ----------------------------------------------------------------------------
diff --git
a/rts/Schedule.c
b/rts/Schedule.c
index
b9b4325
..
49e25be
100644
(file)
--- a/
rts/Schedule.c
+++ b/
rts/Schedule.c
@@
-2584,6
+2584,7
@@
exitScheduler( void )
boundTaskExiting(task);
stopTaskManager();
}
boundTaskExiting(task);
stopTaskManager();
}
+ closeMutex(&sched_mutex);
#endif
}
#endif
}
diff --git
a/rts/Stable.c
b/rts/Stable.c
index
2c4157b
..
813c6c8
100644
(file)
--- a/
rts/Stable.c
+++ b/
rts/Stable.c
@@
-169,6
+169,9
@@
exitStablePtrTable(void)
stgFree(stable_ptr_table);
stable_ptr_table = NULL;
SPT_size = 0;
stgFree(stable_ptr_table);
stable_ptr_table = NULL;
SPT_size = 0;
+#ifdef THREADED_RTS
+ closeMutex(&stable_mutex);
+#endif
}
/*
}
/*
diff --git
a/rts/Storage.c
b/rts/Storage.c
index
3594f71
..
0c9c60e
100644
(file)
--- a/
rts/Storage.c
+++ b/
rts/Storage.c
@@
-279,6
+279,10
@@
freeStorage (void)
stgFree(generations[g].steps);
stgFree(generations);
freeAllMBlocks();
stgFree(generations[g].steps);
stgFree(generations);
freeAllMBlocks();
+#if defined(THREADED_RTS)
+ closeMutex(&sm_mutex);
+ closeMutex(&atomic_modify_mutvar_mutex);
+#endif
}
/* -----------------------------------------------------------------------------
}
/* -----------------------------------------------------------------------------
diff --git
a/rts/Task.c
b/rts/Task.c
index
3be5b28
..
a03ed87
100644
(file)
--- a/
rts/Task.c
+++ b/
rts/Task.c
@@
-77,6
+77,10
@@
stopTaskManager (void)
for (task = task_free_list; task != NULL; task = next) {
next = task->next;
stgFree(task);
for (task = task_free_list; task != NULL; task = next) {
next = task->next;
stgFree(task);
+#if defined(THREADED_RTS)
+ closeCondition(&task->cond);
+ closeMutex(&task->lock);
+#endif
}
task_free_list = NULL;
RELEASE_LOCK(&sched_mutex);
}
task_free_list = NULL;
RELEASE_LOCK(&sched_mutex);
diff --git
a/rts/Typeable.c
b/rts/Typeable.c
index
e07c764
..
4c4d460
100644
(file)
--- a/
rts/Typeable.c
+++ b/
rts/Typeable.c
@@
-20,7
+20,7
@@
void
exitTypeableStore()
\r
{
\r
#ifdef THREADED_RTS
\r
exitTypeableStore()
\r
{
\r
#ifdef THREADED_RTS
\r
- /* TODO: Free Mutex! */
\r
+ closeMutex(&typeableStoreLock);
\r
#endif
\r
if(typeableStore!=0) {
\r
freeStablePtr((StgStablePtr)typeableStore);
\r
#endif
\r
if(typeableStore!=0) {
\r
freeStablePtr((StgStablePtr)typeableStore);
\r
diff --git
a/rts/posix/OSThreads.c
b/rts/posix/OSThreads.c
index
cff3782
..
b30d085
100644
(file)
--- a/
rts/posix/OSThreads.c
+++ b/
rts/posix/OSThreads.c
@@
-106,6
+106,11
@@
initMutex(Mutex* pMut)
#endif
return;
}
#endif
return;
}
+void
+closeMutex(Mutex* pMut)
+{
+ pthread_mutex_destroy(pMut);
+}
void
newThreadLocalKey (ThreadLocalKey *key)
void
newThreadLocalKey (ThreadLocalKey *key)
diff --git
a/rts/win32/OSThreads.c
b/rts/win32/OSThreads.c
index
c772be3
..
00effda
100644
(file)
--- a/
rts/win32/OSThreads.c
+++ b/
rts/win32/OSThreads.c
@@
-116,6
+116,11
@@
initMutex (Mutex* pMut)
{
InitializeCriticalSectionAndSpinCount(pMut,4000);
}
{
InitializeCriticalSectionAndSpinCount(pMut,4000);
}
+void
+closeMutex (Mutex* pMut)
+{
+ DeleteCriticalSection(pMut);
+}
#else
void
initMutex (Mutex* pMut)
#else
void
initMutex (Mutex* pMut)
@@
-127,6
+132,11
@@
initMutex (Mutex* pMut)
*pMut = h;
return;
}
*pMut = h;
return;
}
+void
+closeMutex (Mutex* pMut)
+{
+ CloseHandle(*pMut);
+}
#endif
void
#endif
void