author | Philipp Wiesemann <philipp.wiesemann@arcor.de> |
Fri, 24 Jun 2016 19:06:06 +0200 | |
changeset 10182 | 4980c48b8dbe |
parent 10146 | 471eb08040ce |
permissions | -rw-r--r-- |
0 | 1 |
/* |
5535
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
2 |
Simple DirectMedia Layer |
9998
f67cf37e9cd4
Updated copyright to 2016
Sam Lantinga <slouken@libsdl.org>
parents:
9619
diff
changeset
|
3 |
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> |
0 | 4 |
|
5535
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
5 |
This software is provided 'as-is', without any express or implied |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
6 |
warranty. In no event will the authors be held liable for any damages |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
7 |
arising from the use of this software. |
0 | 8 |
|
5535
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
9 |
Permission is granted to anyone to use this software for any purpose, |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
10 |
including commercial applications, and to alter it and redistribute it |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
11 |
freely, subject to the following restrictions: |
0 | 12 |
|
5535
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
13 |
1. The origin of this software must not be misrepresented; you must not |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
14 |
claim that you wrote the original software. If you use this software |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
15 |
in a product, an acknowledgment in the product documentation would be |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
16 |
appreciated but is not required. |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
17 |
2. Altered source versions must be plainly marked as such, and must not be |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
18 |
misrepresented as being the original software. |
96594ac5fd1a
SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents:
5509
diff
changeset
|
19 |
3. This notice may not be removed or altered from any source distribution. |
0 | 20 |
*/ |
8093
b43765095a6f
Make internal SDL sources include SDL_internal.h instead of SDL_config.h
Ryan C. Gordon <icculus@icculus.org>
parents:
7978
diff
changeset
|
21 |
#include "../SDL_internal.h" |
0 | 22 |
|
23 |
/* These are functions that need to be implemented by a port of SDL */ |
|
24 |
||
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
25 |
#ifndef _SDL_systhread_h |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
26 |
#define _SDL_systhread_h |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
27 |
|
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
28 |
#include "SDL_thread.h" |
7730
e928464b98ec
Fixed bug 2076 - OpenGL doesn't work with --disable-threads
Sam Lantinga <slouken@libsdl.org>
parents:
7393
diff
changeset
|
29 |
#include "SDL_thread_c.h" |
0 | 30 |
|
31 |
/* This function creates a thread, passing args to SDL_RunThread(), |
|
32 |
saves a system-dependent thread id in thread->id, and returns 0 |
|
33 |
on success. |
|
34 |
*/ |
|
1471
9fb0eee04dd9
Enabled libc support on Win32, so we don't break binary compatibility in 1.2
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
35 |
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1471
diff
changeset
|
36 |
extern int SDL_SYS_CreateThread(SDL_Thread * thread, void *args, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1471
diff
changeset
|
37 |
pfnSDL_CurrentBeginThread pfnBeginThread, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1471
diff
changeset
|
38 |
pfnSDL_CurrentEndThread pfnEndThread); |
1190 | 39 |
#else |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1471
diff
changeset
|
40 |
extern int SDL_SYS_CreateThread(SDL_Thread * thread, void *args); |
1190 | 41 |
#endif |
0 | 42 |
|
43 |
/* This function does any necessary setup in the child thread */ |
|
5969
3a041d215edc
1.3 API CHANGE: Add support for naming threads.
Ryan C. Gordon <icculus@icculus.org>
parents:
5535
diff
changeset
|
44 |
extern void SDL_SYS_SetupThread(const char *name); |
0 | 45 |
|
5509
5b1b4d820d10
The API sets the priority for the current thread, not an arbitrary thread.
Sam Lantinga <slouken@libsdl.org>
parents:
5506
diff
changeset
|
46 |
/* This function sets the current thread priority */ |
5b1b4d820d10
The API sets the priority for the current thread, not an arbitrary thread.
Sam Lantinga <slouken@libsdl.org>
parents:
5506
diff
changeset
|
47 |
extern int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority); |
5506
82a09d5d0f07
Implemented SDL_SetThreadPriority()
Sam Lantinga <slouken@libsdl.org>
parents:
5262
diff
changeset
|
48 |
|
0 | 49 |
/* This function waits for the thread to finish and frees any data |
50 |
allocated by SDL_SYS_CreateThread() |
|
51 |
*/ |
|
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1471
diff
changeset
|
52 |
extern void SDL_SYS_WaitThread(SDL_Thread * thread); |
0 | 53 |
|
7978
70ac84e49797
Added SDL_DetachThread() API.
Ryan C. Gordon <icculus@icculus.org>
parents:
7730
diff
changeset
|
54 |
/* Mark thread as cleaned up as soon as it exits, without joining. */ |
70ac84e49797
Added SDL_DetachThread() API.
Ryan C. Gordon <icculus@icculus.org>
parents:
7730
diff
changeset
|
55 |
extern void SDL_SYS_DetachThread(SDL_Thread * thread); |
70ac84e49797
Added SDL_DetachThread() API.
Ryan C. Gordon <icculus@icculus.org>
parents:
7730
diff
changeset
|
56 |
|
7393
358696c354a8
Added release/acquire memory barriers to the atomic API
Sam Lantinga <slouken@libsdl.org>
parents:
6885
diff
changeset
|
57 |
/* Get the thread local storage for this thread */ |
358696c354a8
Added release/acquire memory barriers to the atomic API
Sam Lantinga <slouken@libsdl.org>
parents:
6885
diff
changeset
|
58 |
extern SDL_TLSData *SDL_SYS_GetTLSData(); |
358696c354a8
Added release/acquire memory barriers to the atomic API
Sam Lantinga <slouken@libsdl.org>
parents:
6885
diff
changeset
|
59 |
|
358696c354a8
Added release/acquire memory barriers to the atomic API
Sam Lantinga <slouken@libsdl.org>
parents:
6885
diff
changeset
|
60 |
/* Set the thread local storage for this thread */ |
358696c354a8
Added release/acquire memory barriers to the atomic API
Sam Lantinga <slouken@libsdl.org>
parents:
6885
diff
changeset
|
61 |
extern int SDL_SYS_SetTLSData(SDL_TLSData *data); |
358696c354a8
Added release/acquire memory barriers to the atomic API
Sam Lantinga <slouken@libsdl.org>
parents:
6885
diff
changeset
|
62 |
|
10146
471eb08040ce
threads: Move SDL's own thread creation to a new internal API.
Ryan C. Gordon <icculus@icculus.org>
parents:
9998
diff
changeset
|
63 |
/* This is for internal SDL use, so we don't need #ifdefs everywhere. */ |
471eb08040ce
threads: Move SDL's own thread creation to a new internal API.
Ryan C. Gordon <icculus@icculus.org>
parents:
9998
diff
changeset
|
64 |
extern SDL_Thread * |
471eb08040ce
threads: Move SDL's own thread creation to a new internal API.
Ryan C. Gordon <icculus@icculus.org>
parents:
9998
diff
changeset
|
65 |
SDL_CreateThreadInternal(int (SDLCALL * fn) (void *), const char *name, |
471eb08040ce
threads: Move SDL's own thread creation to a new internal API.
Ryan C. Gordon <icculus@icculus.org>
parents:
9998
diff
changeset
|
66 |
const size_t stacksize, void *data); |
471eb08040ce
threads: Move SDL's own thread creation to a new internal API.
Ryan C. Gordon <icculus@icculus.org>
parents:
9998
diff
changeset
|
67 |
|
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
68 |
#endif /* _SDL_systhread_h */ |
3579
3427271a2d75
Added SDL_GetCPUCount() to see how many cores are available.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
69 |
|
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1471
diff
changeset
|
70 |
/* vi: set ts=4 sw=4 expandtab: */ |