File: gtmrecv_end_helpers.c

package info (click to toggle)
fis-gtm 6.2-000-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 30,784 kB
  • ctags: 42,554
  • sloc: ansic: 358,483; asm: 4,847; csh: 4,574; sh: 2,261; awk: 200; makefile: 86; sed: 13
file content (59 lines) | stat: -rw-r--r-- 1,907 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/****************************************************************
 *								*
 *	Copyright 2005 Fidelity Information Services, Inc.	*
 *								*
 *	This source code contains the intellectual property	*
 *	of its copyright holder(s), and is made available	*
 *	under a license.  If you do not know the terms of	*
 *	the license, please stop and do not read further.	*
 *								*
 ****************************************************************/

#include "mdef.h"

#include "gtm_stdio.h"

#ifdef UNIX
#include <sys/wait.h>
#elif defined(VMS)
#include <descrip.h> /* Required for gtmrecv.h */
#endif

#include "gdsroot.h"
#include "gdsblk.h"
#include "gtm_facility.h"
#include "fileinfo.h"
#include "gdsbt.h"
#include "gdsfhead.h"
#include "filestruct.h"
#include "iosp.h"
#include "repl_shutdcode.h"
#include "gtmrecv.h"
#include "is_proc_alive.h"
#include "eintr_wrappers.h"
#include "repl_log.h"

GBLREF recvpool_addrs	recvpool;

int gtmrecv_end_helpers(boolean_t is_rcvr_srvr)
{ /* Set flag in recvpool telling the receiver server to stop all reader and writer helpers.
   * Wait for receiver server to complete the processs - all processes shut down, or some error occurred
   */
	upd_helper_ctl_ptr_t	upd_helper_ctl;
	upd_helper_entry_ptr_t	helper, helper_top;

	repl_log(stdout, TRUE, TRUE, "Initiating shut down of Helpers\n");
	upd_helper_ctl = recvpool.upd_helper_ctl;
	for (helper = upd_helper_ctl->helper_list, helper_top = helper + MAX_UPD_HELPERS; helper < helper_top; helper++)
		helper->helper_shutdown = SHUTDOWN;  /* indicate to the helper to shut down */
	if (is_rcvr_srvr)
		gtmrecv_reap_helpers(TRUE);
	else
	{
		upd_helper_ctl->reap_helpers = HELPER_REAP_WAIT;
		while (HELPER_REAP_NONE != upd_helper_ctl->reap_helpers && SRV_ALIVE == is_recv_srv_alive())
			SHORT_SLEEP(GTMRECV_WAIT_FOR_UPD_SHUTDOWN);
		upd_helper_ctl->reap_helpers = HELPER_REAP_NONE;
	}
	return NORMAL_SHUTDOWN;
}