File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ target_link_libraries(netconf2 ${CMAKE_THREAD_LIBS_INIT})
176176set (CMAKE_REQUIRED_LIBRARIES pthread)
177177check_include_file (stdatomic.h HAVE_STDATOMIC )
178178check_function_exists (pthread_mutex_timedlock HAVE_PTHREAD_MUTEX_TIMEDLOCK )
179+ check_function_exists (pthread_rwlockattr_setkind_np HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP )
179180
180181# dependencies - openssl
181182if (ENABLE_TLS OR ENABLE_DNSSEC OR ENABLE_SSH)
Original file line number Diff line number Diff line change 7373 */
7474#define NC_PS_QUEUE_SIZE @MAX_PSPOLL_THREAD_COUNT@
7575
76+ /* Portability feature-check macros. */
77+ #cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP
78+
7679#endif /* NC_CONFIG_H_ */
Original file line number Diff line number Diff line change @@ -560,6 +560,7 @@ nc_server_init(struct ly_ctx *ctx)
560560 errno = 0 ;
561561
562562 if (pthread_rwlockattr_init (& attr ) == 0 ) {
563+ #if defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP )
563564 if (pthread_rwlockattr_setkind_np (& attr , PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP ) == 0 ) {
564565 if (pthread_rwlock_init (& server_opts .endpt_lock , & attr ) != 0 ) {
565566 ERR ("%s: failed to init rwlock(%s)." , __FUNCTION__ , strerror (errno ));
@@ -570,6 +571,7 @@ nc_server_init(struct ly_ctx *ctx)
570571 } else {
571572 ERR ("%s: failed set attribute (%s)." , __FUNCTION__ , strerror (errno ));
572573 }
574+ #endif
573575 pthread_rwlockattr_destroy (& attr );
574576 } else {
575577 ERR ("%s: failed init attribute (%s)." , __FUNCTION__ , strerror (errno ));
You can’t perform that action at this time.
0 commit comments