summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-09-18 16:30:52 +0200
committerHaru <haru@dotalux.com>2013-09-18 16:43:04 +0200
commita2722019a379f83ee5a1b35a1a100400e3e7170e (patch)
tree4e00c40e7a9e6e6e8d3558e9c558d00df4773b50 /src/common
parentbabdf60b0339ac4249072a4ba13d27052e0b2fc5 (diff)
downloadhercules-a2722019a379f83ee5a1b35a1a100400e3e7170e.tar.gz
hercules-a2722019a379f83ee5a1b35a1a100400e3e7170e.tar.bz2
hercules-a2722019a379f83ee5a1b35a1a100400e3e7170e.tar.xz
hercules-a2722019a379f83ee5a1b35a1a100400e3e7170e.zip
Fixed a race condition leading to a crash on server shutdown on linux
Fixes bugreport:7699, thanks to bgamez23 (bugreport), Ind (testing, brainstorming) http://hercules.ws/board/tracker/issue-7699-map-crashed-on-the-latest-version/ Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/thread.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/common/thread.c b/src/common/thread.c
index 315b310b2..4d110f2dd 100644
--- a/src/common/thread.c
+++ b/src/common/thread.c
@@ -96,15 +96,11 @@ void rathread_final(){
// gets called whenever a thread terminated ..
-static void rat_thread_terminated( rAthread handle ){
-
- int id_backup = handle->myID;
-
- // Simply set all members to 0 (except the id)
- memset(handle, 0x00, sizeof(struct rAthread));
-
- handle->myID = id_backup; // done ;)
-
+static void rat_thread_terminated(rAthread handle) {
+ // Preserve handle->myID and handle->hThread, set everything else to its default value
+ handle->param = NULL;
+ handle->proc = NULL;
+ handle->prio = RAT_PRIO_NORMAL;
}//end: rat_thread_terminated()
#ifdef WIN32