Remove delay in library on corosync shutdown

Patch removes 2 seconds delay in library on normal corosync shutdown.
Delay is still present on abnormal shutdown.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@3059 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Jan Friesse 2010-10-12 13:03:37 +00:00
parent d14d07d02d
commit 7c8cdfb197
2 changed files with 17 additions and 1 deletions

View File

@ -547,6 +547,13 @@ static inline int conn_info_destroy (struct conn_info *conn_info)
list_del (&conn_info->list);
pthread_mutex_unlock (&conn_info->mutex);
/*
* Let library know, that connection is now closed
*/
conn_info->control_buffer->ipc_closed = 1;
ipc_sem_post (conn_info->control_buffer, SEMAPHORE_RESPONSE);
ipc_sem_post (conn_info->control_buffer, SEMAPHORE_DISPATCH);
#if _POSIX_THREAD_PROCESS_SHARED > 0
sem_destroy (&conn_info->control_buffer->sem_request_or_flush_or_exit);
sem_destroy (&conn_info->control_buffer->sem_request);

View File

@ -92,6 +92,7 @@ struct control_buffer {
#else
int semid;
#endif
int ipc_closed;
};
enum res_init_types {
@ -202,7 +203,11 @@ retry_sem_wait:
if (res == -1) {
return (CS_ERR_LIBRARY);
}
} else {
} else {
if (control_buffer->ipc_closed) {
return (CS_ERR_LIBRARY);
}
timeout.tv_sec = time(NULL) + IPC_SEMWAIT_TIMEOUT;
timeout.tv_nsec = 0;
@ -243,6 +248,10 @@ retry_poll:
if (res == -1) {
return (CS_ERR_LIBRARY);
}
if (res == 0 && control_buffer->ipc_closed) {
return (CS_ERR_LIBRARY);
}
}
#else
sop.sem_num = sem_id;