(svn r13411) -Codechange: remove the return value from the thread procs because it is never used.

This commit is contained in:
rubidium 2008-06-08 10:51:36 +00:00
parent b1dc705492
commit 96d7f87cc9
7 changed files with 20 additions and 39 deletions

View File

@ -109,7 +109,7 @@ private:
/**
* First function which is called within the fiber.
*/
static void * CDECL stFiberProc(void *fiber)
static void stFiberProc(void *fiber)
{
Fiber_Thread *cur = (Fiber_Thread *)fiber;
/* Now suspend the thread until we get SwitchToFiber() for the first time */
@ -124,8 +124,6 @@ private:
s_main->m_sem->Set();
throw;
}
return NULL;
}
};

View File

@ -85,7 +85,7 @@ bool IsGenerateWorldThreaded()
/**
* The internal, real, generate function.
*/
static void * CDECL _GenerateWorld(void *arg)
static void _GenerateWorld(void *arg)
{
try {
_generating_world = true;
@ -170,7 +170,6 @@ static void * CDECL _GenerateWorld(void *arg)
_generating_world = false;
throw;
}
return NULL;
}
/**

View File

@ -1607,10 +1607,9 @@ static SaveOrLoadResult SaveFileToDisk(bool threaded)
}
}
static void * CDECL SaveFileToDiskThread(void *arg)
static void SaveFileToDiskThread(void *arg)
{
SaveFileToDisk(true);
return NULL;
}
void WaitTillSaved()

View File

@ -5,7 +5,7 @@
#ifndef THREAD_H
#define THREAD_H
typedef void * (CDECL *OTTDThreadFunc)(void *);
typedef void (*OTTDThreadFunc)(void *);
/**
* A Thread Object which works on all our supported OSes.
@ -37,7 +37,7 @@ public:
/**
* Join this thread.
*/
virtual void *Join() = 0;
virtual void Join() = 0;
/**
* Check if this thread is the current active thread.
@ -64,7 +64,7 @@ public:
* Convert the current thread to a new ThreadObject.
* @return A new ThreadObject with the current thread attached to it.
*/
static ThreadObject* AttachCurrent();
static ThreadObject *AttachCurrent();
/**
* Find the Id of the current running thread.

View File

@ -34,7 +34,6 @@ struct OTTDThreadStartupMessage {
struct Message msg; ///< standard exec.library message (MUST be the first thing in the message struct!)
OTTDThreadFunc func; ///< function the thread will execute
void *arg; ///< functions arguments for the thread function
void *ret; ///< return value of the thread function
};
@ -79,7 +78,6 @@ public:
/* Things we'll pass down to the child by utilizing NP_StartupMsg */
m_msg.func = proc;
m_msg.arg = param;
m_msg.ret = NULL;
m_replyport = CreateMsgPort();
@ -161,10 +159,9 @@ public:
return true;
}
/* virtual */ void *Join()
/* virtual */ void Join()
{
struct OTTDThreadStartupMessage *reply;
void *ret;
/* You cannot join yourself */
assert(!IsCurrent());
@ -173,13 +170,9 @@ public:
KPutStr("[OpenTTD] Wait for child to quit...\n");
WaitPort(m_replyport);
reply = (struct OTTDThreadStartupMessage *)GetMsg(m_replyport);
ret = reply->ret;
GetMsg(m_replyport);
DeleteMsgPort(m_replyport);
m_thr = 0;
return ret;
}
/* virtual */ bool IsCurrent()
@ -209,7 +202,7 @@ private:
if (NewGetTaskAttrs(NULL, &msg, sizeof(struct OTTDThreadStartupMessage *), TASKINFOTYPE_STARTUPMSG, TAG_DONE) && msg != NULL) {
try {
msg->ret = msg->func(msg->arg);
msg->func(msg->arg);
} catch(...) {
KPutStr("[Child] Returned to main()\n");
}
@ -256,7 +249,7 @@ public:
/* virtual */ void Set()
{
// Check if semaphore count is really important there.
/* Check if semaphore count is really important there. */
ReleaseSemaphore(&m_sem);
}

View File

@ -95,18 +95,15 @@ public:
throw 0;
}
/* virtual */ void *Join()
/* virtual */ void Join()
{
/* You cannot join yourself */
assert(!IsCurrent());
void *ret;
pthread_join(m_thr, &ret);
pthread_join(m_thr, NULL);
m_thr = 0;
delete this;
return ret;
}
/* virtual */ bool IsCurrent()
@ -126,14 +123,15 @@ private:
*/
static void *stThreadProc(void *thr)
{
return ((ThreadObject_pthread *)thr)->ThreadProc();
((ThreadObject_pthread *)thr)->ThreadProc();
pthread_exit(NULL);
}
/**
* A new thread is created, and this function is called. Call the custom
* function of the creator of the thread.
*/
void *ThreadProc()
void ThreadProc()
{
/* The new thread stops here so the calling thread can complete pthread_create() call */
sem_wait(&m_sem_start);
@ -152,8 +150,6 @@ private:
sem_post(&m_sem_stop);
if (exit) delete this;
pthread_exit(NULL);
}
};

View File

@ -20,7 +20,6 @@ private:
OTTDThreadFunc m_proc;
void *m_param;
bool m_attached;
void *ret;
public:
/**
@ -91,14 +90,12 @@ public:
throw 0;
}
/* virtual */ void *Join()
/* virtual */ void Join()
{
/* You cannot join yourself */
assert(!IsCurrent());
WaitForSingleObject(m_h_thr, INFINITE);
return this->ret;
}
/* virtual */ bool IsCurrent()
@ -119,21 +116,20 @@ private:
*/
static uint CALLBACK stThreadProc(void *thr)
{
return ((ThreadObject_Win32 *)thr)->ThreadProc();
((ThreadObject_Win32 *)thr)->ThreadProc();
return 0;
}
/**
* A new thread is created, and this function is called. Call the custom
* function of the creator of the thread.
*/
uint ThreadProc()
void ThreadProc()
{
try {
this->ret = m_proc(m_param);
m_proc(m_param);
} catch (...) {
}
return 0;
}
};