mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8339475: Clean up return code handling for pthread calls in library coding
Reviewed-by: clanger, jwaters
This commit is contained in:
parent
85dba47925
commit
2a2ecc994e
4 changed files with 16 additions and 14 deletions
|
@ -297,6 +297,7 @@ static void ParkEventLoop() {
|
|||
static void MacOSXStartup(int argc, char *argv[]) {
|
||||
// Thread already started?
|
||||
static jboolean started = false;
|
||||
int rc;
|
||||
if (started) {
|
||||
return;
|
||||
}
|
||||
|
@ -309,12 +310,14 @@ static void MacOSXStartup(int argc, char *argv[]) {
|
|||
|
||||
// Fire up the main thread
|
||||
pthread_t main_thr;
|
||||
if (pthread_create(&main_thr, NULL, &apple_main, &args) != 0) {
|
||||
JLI_ReportErrorMessageSys("Could not create main thread: %s\n", strerror(errno));
|
||||
rc = pthread_create(&main_thr, NULL, &apple_main, &args);
|
||||
if (rc != 0) {
|
||||
JLI_ReportErrorMessageSys("Could not create main thread, return code: %s\n", rc);
|
||||
exit(1);
|
||||
}
|
||||
if (pthread_detach(main_thr)) {
|
||||
JLI_ReportErrorMessageSys("pthread_detach() failed: %s\n", strerror(errno));
|
||||
rc = pthread_detach(main_thr);
|
||||
if (rc != 0) {
|
||||
JLI_ReportErrorMessage("pthread_detach() failed, return code: %s\n", rc);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -243,13 +243,7 @@ JLI_ReportErrorMessage(const char* fmt, ...) {
|
|||
JNIEXPORT void JNICALL
|
||||
JLI_ReportErrorMessageSys(const char* fmt, ...) {
|
||||
va_list vl;
|
||||
char *emsg;
|
||||
|
||||
/*
|
||||
* TODO: its safer to use strerror_r but is not available on
|
||||
* Solaris 8. Until then....
|
||||
*/
|
||||
emsg = strerror(errno);
|
||||
char *emsg = strerror(errno);
|
||||
if (emsg != NULL) {
|
||||
fprintf(stderr, "%s\n", emsg);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue