Skip to content

Commit

Permalink
JBR-6071 Alpine Linux compilation: error: implicit declaration of fun…
Browse files Browse the repository at this point in the history
…ction 'pthread_getname_np'
  • Loading branch information
mkartashev authored and jbrbot committed Nov 8, 2024
1 parent 05ad0c3 commit 72722da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
15 changes: 1 addition & 14 deletions src/java.desktop/unix/native/common/java2d/wl/WLBuffers.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,9 @@ ReportFatalError(const char* file, int line, const char *msg)
assert(0);
}

static inline void
AssertCalledOnEDT(const char* file, int line)
{
char threadName[16];
pthread_getname_np(pthread_self(), threadName, sizeof(threadName));
if (strncmp(threadName, "AWT-EventQueue", 14) != 0) {
fprintf(stderr, "Assert failed (called on %s instead of EDT) at %s:%d\n", threadName, file, line);
fflush(stderr);
assert(0);
}
}

static void
AssertDrawLockIsHeld(WLSurfaceBufferManager* manager, const char * file, int line);

#define ASSERT_ON_EDT() AssertCalledOnEDT(__FILE__, __LINE__)
#define WL_FATAL_ERROR(msg) ReportFatalError(__FILE__, __LINE__, msg)
#define ASSERT_DRAW_LOCK_IS_HELD(manager) AssertDrawLockIsHeld(manager, __FILE__, __LINE__)
#define ASSERT_SHOW_LOCK_IS_HELD(manager) AssertShowLockIsHeld(manager, __FILE__, __LINE__)
Expand Down Expand Up @@ -773,7 +760,7 @@ WLSBM_Create(jint width, jint height, jint scale, jint bgPixel, jint wlShmFormat
// both read from and written to (when scrolling, for instance).
// So it needs to be able to be "locked" twice: once for writing and
// once for reading.
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&manager->drawLock, &attr);
DrawBufferCreate(manager);
ShowBufferCreate(manager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ Java_sun_java2d_wl_WLSMSurfaceData_initOps(JNIEnv *env, jobject wsd,
// Recursive mutex is required because blit can be done with both source
// and destination being the same surface (during scrolling, for example).
// So WLSD_Lock() should be able to lock the same surface twice in a row.
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&wsdo->lock, &attr);
#endif /* !HEADLESS */
}

0 comments on commit 72722da

Please sign in to comment.