Fixed bug #215
The current SVN trunk is missing the SDLCALL specifier at numerous locations. It has to be added for all (possibly user provided) callbacks. I stumbled over this while creating a makefile for the OpenWatcom compiler for Win32. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401728
This commit is contained in:
parent
cab8a203a7
commit
b4ba6518d6
19 changed files with 85 additions and 63 deletions
|
@ -32,7 +32,7 @@ static void quit(int rc)
|
|||
}
|
||||
|
||||
|
||||
void fillerup(void *unused, Uint8 *stream, int len)
|
||||
void SDLCALL fillerup(void *unused, Uint8 *stream, int len)
|
||||
{
|
||||
Uint8 *waveptr;
|
||||
int waveleft;
|
||||
|
|
|
@ -17,7 +17,7 @@ static void quit(int rc)
|
|||
exit(rc);
|
||||
}
|
||||
|
||||
int ThreadFunc(void *data)
|
||||
int SDLCALL ThreadFunc(void *data)
|
||||
{
|
||||
/* Set the child thread error string */
|
||||
SDL_SetError("Thread %s (%d) had a problem: %s",
|
||||
|
|
|
@ -17,7 +17,7 @@ static void quit(int rc)
|
|||
exit(rc);
|
||||
}
|
||||
|
||||
int ThreadFunc(void *data)
|
||||
int SDLCALL ThreadFunc(void *data)
|
||||
{
|
||||
printf("Started thread %s: My thread id is %u\n",
|
||||
(char *)data, SDL_ThreadID());
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_mutex.h"
|
||||
|
@ -14,6 +13,7 @@
|
|||
static SDL_mutex *mutex = NULL;
|
||||
static Uint32 mainthread;
|
||||
static SDL_Thread *threads[6];
|
||||
static volatile int doterminate = 0;
|
||||
|
||||
/*
|
||||
* SDL_Quit() shouldn't be used with atexit() directly because
|
||||
|
@ -31,8 +31,8 @@ void printid(void)
|
|||
|
||||
void terminate(int sig)
|
||||
{
|
||||
printf("Process %u: raising SIGTERM\n", SDL_ThreadID());
|
||||
raise(SIGTERM);
|
||||
signal(SIGINT, terminate);
|
||||
doterminate = 1;
|
||||
}
|
||||
void closemutex(int sig)
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ void closemutex(int sig)
|
|||
SDL_DestroyMutex(mutex);
|
||||
exit(sig);
|
||||
}
|
||||
int Run(void *data)
|
||||
int SDLCALL Run(void *data)
|
||||
{
|
||||
if ( SDL_ThreadID() == mainthread )
|
||||
signal(SIGTERM, closemutex);
|
||||
|
@ -63,6 +63,10 @@ int Run(void *data)
|
|||
}
|
||||
/* If this sleep isn't done, then threads may starve */
|
||||
SDL_Delay(10);
|
||||
if (SDL_ThreadID() == mainthread && doterminate) {
|
||||
printf("Process %u: raising SIGTERM\n", SDL_ThreadID());
|
||||
raise(SIGTERM);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
static SDL_sem *sem;
|
||||
int alive = 1;
|
||||
|
||||
int ThreadFunc(void *data)
|
||||
int SDLCALL ThreadFunc(void *data)
|
||||
{
|
||||
int threadnum = (int)(uintptr_t)data;
|
||||
while ( alive ) {
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
|
||||
static int ticks = 0;
|
||||
|
||||
static Uint32 ticktock(Uint32 interval)
|
||||
static Uint32 SDLCALL ticktock(Uint32 interval)
|
||||
{
|
||||
++ticks;
|
||||
return(interval);
|
||||
}
|
||||
|
||||
static Uint32 callback(Uint32 interval, void *param)
|
||||
static Uint32 SDLCALL callback(Uint32 interval, void *param)
|
||||
{
|
||||
printf("Timer %d : param = %d\n", interval, (int)(uintptr_t)param);
|
||||
return interval;
|
||||
|
|
|
@ -168,7 +168,7 @@ void HotKey_Quit(void)
|
|||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
int FilterEvents(const SDL_Event *event)
|
||||
int SDLCALL FilterEvents(const SDL_Event *event)
|
||||
{
|
||||
static int reallyquit = 0;
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ SDL_Surface *LoadIconSurface(char *file, Uint8 **maskp)
|
|||
return(icon);
|
||||
}
|
||||
|
||||
int FilterEvents(const SDL_Event *event)
|
||||
int SDLCALL FilterEvents(const SDL_Event *event)
|
||||
{
|
||||
static int reallyquit = 0;
|
||||
|
||||
|
@ -127,7 +127,7 @@ int FilterEvents(const SDL_Event *event)
|
|||
}
|
||||
}
|
||||
|
||||
int HandleMouse(void *unused)
|
||||
int SDLCALL HandleMouse(void *unused)
|
||||
{
|
||||
SDL_Event events[10];
|
||||
int i, found;
|
||||
|
@ -164,7 +164,7 @@ int HandleMouse(void *unused)
|
|||
return(0);
|
||||
}
|
||||
|
||||
int HandleKeyboard(void *unused)
|
||||
int SDLCALL HandleKeyboard(void *unused)
|
||||
{
|
||||
SDL_Event events[10];
|
||||
int i, found;
|
||||
|
|
|
@ -20,14 +20,14 @@ static void quit(int rc)
|
|||
exit(rc);
|
||||
}
|
||||
|
||||
int SubThreadFunc(void *data) {
|
||||
int SDLCALL SubThreadFunc(void *data) {
|
||||
while(! *(int volatile *)data) {
|
||||
; /*SDL_Delay(10);*/ /* do nothing */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ThreadFunc(void *data) {
|
||||
int SDLCALL ThreadFunc(void *data) {
|
||||
SDL_Thread *sub_threads[NUMTHREADS];
|
||||
int flags[NUMTHREADS];
|
||||
int i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue