📄 shrcommit.c
字号:
/******************************************************************* * * * shrcommit.c * * * * This file is a part of the eXtremeDB HA framework * * Copyright (c) 2001-2006 McObject LLC * * All Rights Reserved * * * *******************************************************************//* * ++ * * PROJECT: eXtremeDB(tm) (c) McObject LLC* * SUBSYSTEM: HA support * * MODULE: shrcommit.c * * ABSTRACT: Shared commit thread for multiprocess commit * * * VERSION: 1.0 * * HISTORY: * 1.0- 1 SS 19-Oct-2003 Created it was * * -- */#include "app.h"#include "mcoHA.h"#include "watchdog.h"#ifdef CFG_SHARED_COMMIT/* * If you wish to use HA with several master processes accessing the * shared memory database in your own implementation of the communication channel, * you should create a separate thread in the 'main' master process in order to implement * the "shared commit". This thread should call mco_HA_trans_commit_synch() function. * Note that the mco_HA_trans_commit_synch() will return an error if the shared commit * has not been initialized yet. If the shared commit mode has been set the function enters * the internal loop and never return control back to the application * (see the thread SynchCommit() in modules appnw... .c) * You must set the shared commit mode via mco_HA_set_mode () function. * In order to set this mode set the par.is_master field to * MCO_MULTIPROCESS_COMMIT. */extern MUTEX_T mutex;THREAD_ID synchcommit = (THREAD_ID)-1;THREAD_PROC_DEFINE(SynchCommit, p){ int i; mco_db_h db = (mco_db_h)p; MCO_RET rc; THREAD_PROC_MODE(); Printf("Master: shared commit started\n"); MUTEX_UNLOCK(&mutex); /* wait 3 seconds until master shared commit mode is initialized */ for(i = 0; i< 60 ; i++) { if ((rc = mco_HA_trans_commit_synch( db )) != MCO_S_OK) return; /* fatal error. The database isn't initialized yet */ Sleep(50); }}THREAD_PROC_FINISH_DEFINE#endif // CFG_SHARED_COMMIT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -