Mercurial > sdl-ios-xcode
annotate src/thread/os2/SDL_sysmutex.c @ 1438:1f4f09641645
Date: Sun, 26 Feb 2006 11:25:09 +0900
From: Hayashi Naoyuki
Subject: Re: [SDL] CVS stable again, please update SDL ports
Some problems are caused on Tru64 UNIX.
If applying SDL12-osf1.path, these problems are fixed.
1. configure-script say "recursive mutexes... no" and "pthread
semaphores... no".
checking for pthreads... yes
checking for recursive mutexes... no
checking for pthread semaphores... no
This is because it compiled without pthread_cflags and pthread_lib when
checking recursive mutexes and pthread semaphores.
2. Compiling src/audio/mme/SDL_mmeaudio.c fails.
cc: Severe: ./src/audio/mme/SDL_mmeaudio.c, line 25: Cannot find file
<mme_api.h> specified in #include directive. (noinclfilef)
#include <mme_api.h>
-^
This is because BUILD_CFLAGS is wrong.
3. Compiling src/cdrom/osf/SDL_syscdrom.c fails.
cc: Warning: ./src/cdrom/osf/SDL_syscdrom.c, line 176: Too few actual
parameters in the invocation of the macro "SDL_stack_alloc". (toofewactuals)
cdpath = SDL_stack_alloc(len);
------------------------------------^
cc: Error: ./src/cdrom/osf/SDL_syscdrom.c, line 176: Invalid expression.
(badexpr)
cdpath = SDL_stack_alloc(len);
-----------------^
SDL_stack_alloc is defined in include/SDL_stdinc.h.
#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count)
4. Linking fails if running configure with --enable-x11-shared=yes.
/usr/ccs/bin/ld:
Warning: Unresolved:
p_XData32
5. Compiling src/video/x11/SDL_x11dyn.c fails if running configure with
--enable-x11-shared=no.
cc: Error: ./src/video/x11/SDL_x11sym.h, line 149: In this statement,
"_SmtBufferOverflow" is not declared. (undeclared)
SDL_X11_SYM(1,void,_SmtBufferOverflow,(Display *dpy,register smtDisplayPtr))
^
cc: Error: ./src/video/x11/SDL_x11sym.h, line 150: In this statement,
"_SmtBufferOverflow" is not declared. (undeclared)
SDL_X11_SYM(1,void,_SmtBufferOverflow,(Display *dpy,register smtDisplayPtr))
^
cc: Error: ./src/video/x11/SDL_x11sym.h, line 150: In this statement,
"_SmtIpError" is not declared. (undeclared)
SDL_X11_SYM(1,void,_SmtIpError,(Display *dpy,register smtDisplayPtr, int))
^
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 26 Feb 2006 04:54:01 +0000 |
parents | d910939febfa |
children | 782fd950bd46 c121d94672cb a1b03ba2fcd0 |
rev | line source |
---|---|
1190 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
1190 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
1190 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
1190 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
13 Lesser General Public License for more details. |
1190 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1190 | 18 |
19 Sam Lantinga | |
20 slouken@libsdl.org | |
21 */ | |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
22 #include "SDL_config.h" |
1190 | 23 |
24 /* Mutex functions using the OS/2 API */ | |
25 | |
26 #define INCL_DOSERRORS | |
27 #define INCL_DOSSEMAPHORES | |
28 #include <os2.h> | |
29 | |
30 #include "SDL_mutex.h" | |
31 | |
32 | |
33 struct SDL_mutex { | |
34 HMTX hmtxID; | |
35 }; | |
36 | |
37 /* Create a mutex */ | |
38 DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void) | |
39 { | |
40 SDL_mutex *mutex; | |
41 APIRET ulrc; | |
42 | |
43 /* Allocate mutex memory */ | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
44 mutex = (SDL_mutex *)SDL_malloc(sizeof(*mutex)); |
1190 | 45 if (mutex) |
46 { | |
47 /* Create the mutex, with initial value signaled */ | |
48 ulrc = DosCreateMutexSem(NULL, // Create unnamed semaphore | |
49 &(mutex->hmtxID), // Pointer to handle | |
50 0L, // Flags: create it private (not shared) | |
51 FALSE); // Initial value: unowned | |
52 if (ulrc!=NO_ERROR) | |
53 { | |
54 SDL_SetError("Couldn't create mutex"); | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
55 SDL_free(mutex); |
1190 | 56 mutex = NULL; |
57 } | |
58 } else { | |
59 SDL_OutOfMemory(); | |
60 } | |
61 return(mutex); | |
62 } | |
63 | |
64 /* Free the mutex */ | |
65 DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex) | |
66 { | |
67 if ( mutex ) | |
68 { | |
69 if ( mutex->hmtxID ) | |
70 { | |
71 DosCloseMutexSem(mutex->hmtxID); | |
72 mutex->hmtxID = 0; | |
73 } | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
74 SDL_free(mutex); |
1190 | 75 } |
76 } | |
77 | |
78 /* Lock the mutex */ | |
79 DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex) | |
80 { | |
81 if ( mutex == NULL ) | |
82 { | |
83 SDL_SetError("Passed a NULL mutex"); | |
84 return -1; | |
85 } | |
86 if ( DosRequestMutexSem(mutex->hmtxID, SEM_INDEFINITE_WAIT) != NO_ERROR ) | |
87 { | |
88 SDL_SetError("Couldn't wait on mutex"); | |
89 return -1; | |
90 } | |
91 return(0); | |
92 } | |
93 | |
94 /* Unlock the mutex */ | |
95 DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex) | |
96 { | |
97 if ( mutex == NULL ) | |
98 { | |
99 SDL_SetError("Passed a NULL mutex"); | |
100 return -1; | |
101 } | |
102 if ( DosReleaseMutexSem(mutex->hmtxID) != NO_ERROR ) | |
103 { | |
104 SDL_SetError("Couldn't release mutex"); | |
105 return -1; | |
106 } | |
107 return(0); | |
108 } |