Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
b5692bd2
Commit
b5692bd2
authored
Oct 18, 2011
by
Ryan C. Gordon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't crash with a NULL thread name.
parent
3d70224c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
22 deletions
+27
-22
SDL_systhread.c
src/thread/beos/SDL_systhread.c
+2
-1
SDL_systhread.c
src/thread/pthread/SDL_systhread.c
+5
-3
SDL_systhread.c
src/thread/windows/SDL_systhread.c
+20
-18
No files found.
src/thread/beos/SDL_systhread.c
View file @
b5692bd2
...
@@ -66,8 +66,9 @@ int
...
@@ -66,8 +66,9 @@ int
SDL_SYS_CreateThread
(
SDL_Thread
*
thread
,
void
*
args
)
SDL_SYS_CreateThread
(
SDL_Thread
*
thread
,
void
*
args
)
{
{
/* The docs say the thread name can't be longer than B_OS_NAME_LENGTH. */
/* The docs say the thread name can't be longer than B_OS_NAME_LENGTH. */
const
char
*
threadname
=
thread
->
name
?
thread
->
name
:
"SDL Thread"
;
char
name
[
B_OS_NAME_LENGTH
];
char
name
[
B_OS_NAME_LENGTH
];
SDL_snprintf
(
name
,
sizeof
(
name
),
"%s"
,
thread
->
name
);
SDL_snprintf
(
name
,
sizeof
(
name
),
"%s"
,
threadname
);
name
[
sizeof
(
name
)
-
1
]
=
'\0'
;
name
[
sizeof
(
name
)
-
1
]
=
'\0'
;
/* Create the thread and go! */
/* Create the thread and go! */
...
...
src/thread/pthread/SDL_systhread.c
View file @
b5692bd2
...
@@ -82,14 +82,16 @@ SDL_SYS_SetupThread(const char *name)
...
@@ -82,14 +82,16 @@ SDL_SYS_SetupThread(const char *name)
int
i
;
int
i
;
sigset_t
mask
;
sigset_t
mask
;
if
(
name
!=
NULL
)
{
#if ( (__MACOSX__ && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)) || \
#if ( (__MACOSX__ && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)) || \
(__IPHONEOS__ && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 30200)) )
(__IPHONEOS__ && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 30200)) )
if
(
pthread_setname_np
!=
NULL
)
{
pthread_setname_np
(
name
);
}
if
(
pthread_setname_np
!=
NULL
)
{
pthread_setname_np
(
name
);
}
#elif HAVE_PTHREAD_SETNAME_NP
#elif HAVE_PTHREAD_SETNAME_NP
pthread_setname_np
(
pthread_self
(),
name
);
pthread_setname_np
(
pthread_self
(),
name
);
#elif HAVE_PTHREAD_SET_NAME_NP
#elif HAVE_PTHREAD_SET_NAME_NP
pthread_set_name_np
(
pthread_self
(),
name
);
pthread_set_name_np
(
pthread_self
(),
name
);
#endif
#endif
}
/* Mask asynchronous signals for this thread */
/* Mask asynchronous signals for this thread */
sigemptyset
(
&
mask
);
sigemptyset
(
&
mask
);
...
...
src/thread/windows/SDL_systhread.c
View file @
b5692bd2
...
@@ -161,25 +161,27 @@ typedef struct tagTHREADNAME_INFO
...
@@ -161,25 +161,27 @@ typedef struct tagTHREADNAME_INFO
void
void
SDL_SYS_SetupThread
(
const
char
*
name
)
SDL_SYS_SetupThread
(
const
char
*
name
)
{
{
#if 0 /* !!! FIXME: __except needs C runtime, which we don't link against. */
if
(
name
!=
NULL
)
{
#ifdef _MSC_VER /* !!! FIXME: can we do SEH on other compilers yet? */
#if 0 /* !!! FIXME: __except needs C runtime, which we don't link against. */
/* This magic tells the debugger to name a thread if it's listening. */
#ifdef _MSC_VER /* !!! FIXME: can we do SEH on other compilers yet? */
THREADNAME_INFO inf;
/* This magic tells the debugger to name a thread if it's listening. */
inf.dwType = 0x1000;
THREADNAME_INFO inf;
inf.szName = name;
inf.dwType = 0x1000;
inf.dwThreadID = (DWORD) -1;
inf.szName = name;
inf.dwFlags = 0;
inf.dwThreadID = (DWORD) -1;
inf.dwFlags = 0;
__try
{
__try
RaiseException(0x406D1388, 0, sizeof(inf)/sizeof(DWORD), (DWORD*)&inf);
{
RaiseException(0x406D1388, 0, sizeof(inf)/sizeof(DWORD), (DWORD*)&inf);
}
__except(EXCEPTION_CONTINUE_EXECUTION)
{
/* The program itself should ignore this bogus exception. */
}
#endif
#endif
}
}
__except(EXCEPTION_CONTINUE_EXECUTION)
{
/* The program itself should ignore this bogus exception. */
}
#endif
#endif
}
}
SDL_threadID
SDL_threadID
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment