zos: use destructor for uv__threadpool_cleanup() (#3376)
On z/OS, instead of calling the uv__threadpool_cleanup() function from inside uv_library_shutdown(), the destructor attribute must be used; otherwise, tests will fail with exit code 1 and no output. Additionally, post() does not need to be called when the destructor attribute is used. Also adds uv__os390_cleanup() function to clean System V message queue on z/OS. Co-authored-by: Igor Todorovski <itodorov@ca.ibm.com> Co-authored-by: Gaby Baghdadi <baghdadi@ca.ibm.com>
This commit is contained in:
parent
4075298df2
commit
0a47e4c771
@ -160,13 +160,20 @@ static void post(QUEUE* q, enum uv__work_kind kind) {
|
||||
}
|
||||
|
||||
|
||||
#ifdef __MVS__
|
||||
/* TODO(itodorov) - zos: revisit when Woz compiler is available. */
|
||||
__attribute__((destructor))
|
||||
#endif
|
||||
void uv__threadpool_cleanup(void) {
|
||||
unsigned int i;
|
||||
|
||||
if (nthreads == 0)
|
||||
return;
|
||||
|
||||
#ifndef __MVS__
|
||||
/* TODO(gabylb) - zos: revisit when Woz compiler is available. */
|
||||
post(&exit_message, UV__WORK_CPU);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < nthreads; i++)
|
||||
if (uv_thread_join(threads + i))
|
||||
|
||||
@ -136,6 +136,11 @@ static void maybe_resize(uv__os390_epoll* lst, unsigned int len) {
|
||||
}
|
||||
|
||||
|
||||
void uv__os390_cleanup(void) {
|
||||
msgctl(uv_backend_fd(uv_default_loop()), IPC_RMID, NULL);
|
||||
}
|
||||
|
||||
|
||||
static void init_message_queue(uv__os390_epoll* lst) {
|
||||
struct {
|
||||
long int header;
|
||||
|
||||
@ -70,5 +70,6 @@ int sem_destroy(UV_PLATFORM_SEM_T* semid);
|
||||
int sem_post(UV_PLATFORM_SEM_T* semid);
|
||||
int sem_trywait(UV_PLATFORM_SEM_T* semid);
|
||||
int sem_wait(UV_PLATFORM_SEM_T* semid);
|
||||
void uv__os390_cleanup(void);
|
||||
|
||||
#endif /* UV_OS390_SYSCALL_H_ */
|
||||
|
||||
@ -901,7 +901,12 @@ void uv_library_shutdown(void) {
|
||||
|
||||
uv__process_title_cleanup();
|
||||
uv__signal_cleanup();
|
||||
#ifdef __MVS__
|
||||
/* TODO(itodorov) - zos: revisit when Woz compiler is available. */
|
||||
uv__os390_cleanup();
|
||||
#else
|
||||
uv__threadpool_cleanup();
|
||||
#endif
|
||||
uv__store_relaxed(&was_shutdown, 1);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user