本文整理汇总了C++中report_status函数的典型用法代码示例。如果您正苦于以下问题:C++ report_status函数的具体用法?C++ report_status怎么用?C++ report_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了report_status函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: control_thread
static void WINAPI control_thread( DWORD action)
{
/**************************************
*
* c o n t r o l _ t h r e a d
*
**************************************
*
* Functional description
* Process a service control request.
*
**************************************/
const DWORD state = SERVICE_RUNNING;
switch (action)
{
case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_SHUTDOWN:
report_status(SERVICE_STOP_PENDING, NO_ERROR, 1, 3000);
SetEvent(stop_event_handle);
return;
case SERVICE_CONTROL_INTERROGATE:
break;
default:
break;
}
report_status(state, NO_ERROR, 0, 0);
}
开发者ID:Alexpux,项目名称:firebird,代码行数:31,代码来源:cntl_guard.cpp
示例2: check_data_dir
/*
* check_data_dir()
*
* This function validates the given cluster directory - we search for a
* small set of subdirectories that we expect to find in a valid $PGDATA
* directory. If any of the subdirectories are missing (or secured against
* us) we display an error message and exit()
*
*/
static void
check_data_dir(const char *pg_data)
{
char subDirName[MAXPGPATH];
int subdirnum;
/* start check with top-most directory */
const char *requiredSubdirs[] = {"", "base", "global", "pg_clog",
"pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase",
"pg_xlog"};
for (subdirnum = 0;
subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]);
++subdirnum)
{
struct stat statBuf;
snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
/* Win32 can't stat() a directory with a trailing slash. */
*requiredSubdirs[subdirnum] ? "/" : "",
requiredSubdirs[subdirnum]);
if (stat(subDirName, &statBuf) != 0)
report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
subDirName, getErrorText(errno));
else if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL, "%s is not a directory\n",
subDirName);
}
}
开发者ID:DBInsight,项目名称:postgres-x2,代码行数:39,代码来源:exec.c
示例3: check_data_dir
/*
* check_data_dir()
*
* This function validates the given cluster directory - we search for a
* small set of subdirectories that we expect to find in a valid $PGDATA
* directory. If any of the subdirectories are missing (or secured against
* us) we display an error message and exit()
*
*/
static void
check_data_dir(const char *pg_data)
{
char subDirName[MAXPGPATH];
int subdirnum;
const char *requiredSubdirs[] = {"base", "global", "pg_clog",
"pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase",
"pg_xlog"};
for (subdirnum = 0;
subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]);
++subdirnum)
{
struct stat statBuf;
snprintf(subDirName, sizeof(subDirName), "%s/%s", pg_data,
requiredSubdirs[subdirnum]);
if (stat(subDirName, &statBuf) != 0)
report_status(PG_FATAL, "check for %s failed: %s\n",
requiredSubdirs[subdirnum], getErrorText(errno));
else if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL, "%s is not a directory\n",
requiredSubdirs[subdirnum]);
}
}
开发者ID:selenamarie,项目名称:postgres,代码行数:35,代码来源:exec.c
示例4: CNTL_main_thread
void WINAPI CNTL_main_thread( DWORD /*argc*/, char* /*argv*/[])
{
/**************************************
*
* C N T L _ m a i n _ t h r e a d
*
**************************************
*
* Functional description
*
**************************************/
service_handle =
RegisterServiceCtrlHandler(service_name->c_str(), control_thread);
if (!service_handle)
return;
// start everything, and wait here for ever, or at
// least until we get the stop event indicating that
// the service is stoping.
bool failure = true;
DWORD temp = 0;
if (report_status(SERVICE_START_PENDING, NO_ERROR, 1, 3000) &&
(stop_event_handle = CreateEvent(NULL, TRUE, FALSE, NULL)) != NULL &&
report_status(SERVICE_START_PENDING, NO_ERROR, 2, 3000) &&
!gds__thread_start(main_handler, NULL, 0, 0, 0) &&
report_status(SERVICE_RUNNING, NO_ERROR, 0, 0))
{
failure = false;
temp = WaitForSingleObject(stop_event_handle, INFINITE);
}
DWORD last_error = 0;
if (failure || temp == WAIT_FAILED)
last_error = GetLastError();
if (stop_event_handle)
CloseHandle(stop_event_handle);
// Once we are stopped, we will tell the server to
// do the same. We could not do this in the control_thread
// since the Services Control Manager is single threaded,
// and thus can only process one request at the time.
SERVICE_STATUS status_info;
SC_HANDLE hScManager = 0, hService = 0;
hScManager =
OpenSCManager(NULL, NULL, GENERIC_READ);
hService = OpenService(hScManager, remote_name->c_str(),
GENERIC_READ | GENERIC_EXECUTE);
ControlService(hService, SERVICE_CONTROL_STOP, &status_info);
CloseServiceHandle(hScManager);
CloseServiceHandle(hService);
report_status(SERVICE_STOPPED, last_error, 0, 0);
}
开发者ID:andrewleech,项目名称:firebird,代码行数:55,代码来源:cntl_guard.cpp
示例5: report_status
void
TAO_NT_Notify_Service::handle_control (DWORD control_code)
{
if (control_code == SERVICE_CONTROL_SHUTDOWN
|| control_code == SERVICE_CONTROL_STOP)
{
report_status (SERVICE_STOP_PENDING);
TAO_ORB_Core_instance ()->reactor ()->end_reactor_event_loop ();
TAO_ORB_Core_instance ()->orb ()->shutdown (1);
report_status (SERVICE_STOPPED);
}
else
ACE_NT_Service::handle_control (control_code);
}
开发者ID:esohns,项目名称:ATCD,代码行数:14,代码来源:NT_Notify_Service.cpp
示例6: report_status
/**
* We do almost the same thing as we do in run_standalone () except that
* we update the report_status after init.
*/
int
Activator_NT_Service::svc (void)
{
ImR_Activator_i server;
Activator_Options opts;
if (opts.init_from_registry() != 0)
{
report_status (SERVICE_STOPPED);
return -1;
}
try
{
int status = server.init (opts);
if (status == -1)
{
report_status (SERVICE_STOPPED);
return -1;
}
else
{
report_status (SERVICE_RUNNING);
server.run ();
status = server.fini ();
report_status (SERVICE_STOPPED);
}
if (status != -1)
return 0;
}
catch (const CORBA::SystemException& sysex)
{
sysex._tao_print_exception (IMR_ACTIVATOR_DISPLAY_NAME);
}
catch (const CORBA::UserException& userex)
{
userex._tao_print_exception (IMR_ACTIVATOR_DISPLAY_NAME);
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception (IMR_ACTIVATOR_DISPLAY_NAME);
}
report_status (SERVICE_STOPPED);
return -1;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:54,代码来源:Activator_NT_Service.cpp
示例7: CNTL_main_thread
void WINAPI CNTL_main_thread( DWORD /*argc*/, char* /*argv*/[])
{
/**************************************
*
* C N T L _ m a i n _ t h r e a d
*
**************************************
*
* Functional description
*
**************************************/
service_handle = RegisterServiceCtrlHandler(service_name->c_str(), control_thread);
if (!service_handle)
return;
int status = 1;
DWORD temp = 0;
if (report_status(SERVICE_START_PENDING, NO_ERROR, 1, 3000) &&
(stop_event_handle = CreateEvent(NULL, TRUE, FALSE, NULL)) != NULL &&
report_status(SERVICE_START_PENDING, NO_ERROR, 2, 3000))
{
try
{
Thread::start(main_handler, NULL, THREAD_medium);
if (report_status(SERVICE_RUNNING, NO_ERROR, 0, 0))
{
status = 0;
temp = WaitForSingleObject(stop_event_handle, INFINITE);
}
}
catch (const Firebird::Exception& ex)
{
iscLogException("CNTL: cannot start service handler thread", ex);
}
}
DWORD last_error = 0;
if (temp == WAIT_FAILED || status)
last_error = GetLastError();
if (stop_event_handle)
CloseHandle(stop_event_handle);
report_status(SERVICE_STOP_PENDING, NO_ERROR, 1, SHUTDOWN_TIMEOUT);
fb_shutdown(SHUTDOWN_TIMEOUT, fb_shutrsn_svc_stopped);
report_status(SERVICE_STOPPED, last_error, 0, 0);
}
开发者ID:Alexpux,项目名称:firebird,代码行数:50,代码来源:cntl.cpp
示例8: check_ok
void
check_ok(migratorContext *ctx)
{
/* all seems well */
report_status(ctx, PG_REPORT, "ok");
fflush(stdout);
}
开发者ID:gluefinance,项目名称:postgres,代码行数:7,代码来源:util.c
示例9: check_ok
void
check_ok(void)
{
/* all seems well */
report_status(PG_REPORT, "ok");
fflush(stdout);
}
开发者ID:mhagander,项目名称:postgres,代码行数:7,代码来源:util.c
示例10: waitforubanchor
/** wait for unbound-anchor process to finish */
static void
waitforubanchor(PROCESS_INFORMATION* pinfo)
{
/* we have 5 seconds scheduled for it, usually it will be very fast,
* with only a UDP message or two (100 msec or so), but the https
* connections could take some time */
DWORD count = 7900;
DWORD ret = WAIT_TIMEOUT;
/* decrease timer every 1/10 second, we are still starting up */
while(ret == WAIT_TIMEOUT) {
ret = WaitForSingleObject(pinfo->hProcess, 100);
if(count > 4000) count -= 100;
else count--; /* go slow, it is taking long */
if(count > 3000)
report_status(SERVICE_START_PENDING, NO_ERROR, count);
}
verbose(VERB_ALGO, "unbound-anchor done");
if(ret != WAIT_OBJECT_0) {
return; /* did not end successfully */
}
if(!GetExitCodeProcess(pinfo->hProcess, &ret)) {
log_err("GetExitCodeProcess failed");
return;
}
verbose(VERB_ALGO, "unbound-anchor exit code is %d", (int)ret);
if(ret != 0) {
log_info("The root trust anchor has been updated.");
}
}
开发者ID:stasic,项目名称:debian-unbound,代码行数:30,代码来源:win_svc.c
示例11: handle_report
bool handle_report()
{
tm_p current = now();
checkin_status(db_handler, current, NULL, NULL);
printf("####################\n");
report_status();
return true;
}
开发者ID:0robustus1,项目名称:checkin,代码行数:8,代码来源:report.c
示例12: hdlr
/**
* Service control handler. Called by serviceControlManager when a control
* code is sent to the service (with ControlService).
* @param ctrl: control code
*/
static void
hdlr(DWORD ctrl)
{
if(ctrl == SERVICE_CONTROL_STOP) {
report_status(SERVICE_STOP_PENDING, NO_ERROR, 0);
service_stop_shutdown = 1;
/* send signal to stop */
if(!WSASetEvent(service_stop_event))
log_err("Could not WSASetEvent: %s",
wsa_strerror(WSAGetLastError()));
return;
} else {
/* ctrl == SERVICE_CONTROL_INTERROGATE or whatever */
/* update status */
report_status(service_status.dwCurrentState, NO_ERROR, 0);
}
}
开发者ID:stasic,项目名称:debian-unbound,代码行数:22,代码来源:win_svc.c
示例13: while
void xc::xsim::main()
{
while (true) {
XsiStatus status = xsi_clock(instance);
report_status(status);
wait();
std::vector<package *>::iterator pkg;
for (pkg = packages.begin();pkg != packages.end();pkg++) {
std::map<std::string, sc_inout_resolved *>::iterator it;
const char *pkg_name = ((*pkg)->id).c_str();
for (it = (*pkg)->pins.begin(); it != (*pkg)->pins.end(); it++) {
sc_inout_resolved *p = (it->second);
const char *pin_name = (it->first).c_str();
unsigned int is_driving;
report_status(xsi_is_pin_driving(instance,
pkg_name,
pin_name,
&is_driving));
if (is_driving) {
unsigned int value;
report_status(xsi_sample_pin(instance,
pkg_name,
pin_name,
&value));
(*p)->write(sc_logic((int) value));
}
else {
sc_logic bit = (*p)->read();
if (bit != 'z' && bit != 'x') {
report_status(xsi_drive_pin(instance,
pkg_name,
pin_name,
bit.to_bool()));
}
}
}
}
}
}
开发者ID:xcore,项目名称:tool_xcore_systemc,代码行数:45,代码来源:xsim.cpp
示例14: check_single_dir
/*
* check_single_dir()
*
* Check for the presence of a single directory in PGDATA, and fail if
* is it missing or not accessible.
*/
static void
check_single_dir(const char *pg_data, const char *subdir)
{
struct stat statBuf;
char subDirName[MAXPGPATH];
snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
/* Win32 can't stat() a directory with a trailing slash. */
*subdir ? "/" : "",
subdir);
if (stat(subDirName, &statBuf) != 0)
report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
subDirName, strerror(errno));
else if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL, "%s is not a directory\n",
subDirName);
}
开发者ID:Tao-Ma,项目名称:postgres,代码行数:24,代码来源:exec.c
示例15: control_thread
static void WINAPI control_thread( DWORD action)
{
/**************************************
*
* c o n t r o l _ t h r e a d
*
**************************************
*
* Functional description
* Process a service control request.
*
**************************************/
const DWORD state = SERVICE_RUNNING;
switch (action)
{
case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_SHUTDOWN:
report_status(SERVICE_STOP_PENDING, NO_ERROR, 1, 3000);
if (hMutex)
ReleaseMutex(hMutex);
SetEvent(stop_event_handle);
return;
case SERVICE_CONTROL_INTERROGATE:
break;
case SERVICE_CREATE_GUARDIAN_MUTEX:
hMutex = OpenMutex(SYNCHRONIZE, FALSE, mutex_name->c_str());
if (hMutex)
{
UINT error_mode = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
SEM_NOOPENFILEERRORBOX | SEM_NOALIGNMENTFAULTEXCEPT;
SetErrorMode(error_mode);
WaitForSingleObject(hMutex, INFINITE);
}
break;
default:
break;
}
report_status(state, NO_ERROR, 0, 0);
}
开发者ID:Alexpux,项目名称:firebird,代码行数:44,代码来源:cntl.cpp
示例16: connect
/// The thread main function.
void InputChannelSender::operator()()
{
try {
connect();
while (connected_ != compute_hostnames_.size()) {
poll_cm_events();
}
data_source_.proceed();
time_begin_ = std::chrono::high_resolution_clock::now();
uint64_t timeslice = 0;
sync_buffer_positions();
sync_data_source(true);
report_status();
while (timeslice < max_timeslice_number_ && !abort_) {
if (try_send_timeslice(timeslice)) {
timeslice++;
}
poll_completion();
data_source_.proceed();
scheduler_.timer();
}
// wait for pending send completions
while (acked_desc_ < timeslice_size_ * timeslice + start_index_desc_) {
poll_completion();
scheduler_.timer();
}
sync_data_source(false);
for (auto& c : conn_) {
c->finalize(abort_);
}
L_(debug) << "[i" << input_index_ << "] "
<< "SENDER loop done";
while (!all_done_) {
poll_completion();
scheduler_.timer();
}
time_end_ = std::chrono::high_resolution_clock::now();
disconnect();
while (connected_ != 0) {
poll_cm_events();
}
summary();
} catch (std::exception& e) {
L_(error) << "exception in InputChannelSender: " << e.what();
}
}
开发者ID:demscher,项目名称:flesnet,代码行数:57,代码来源:InputChannelSender.cpp
示例17: ks_multicg_hybrid_field
// Do a multimass CG followed by calls to individual CG's
// to finish off.
static int ks_multicg_hybrid_field( /* Return value is number of iterations taken */
su3_vector *src, /* source vector (type su3_vector) */
su3_vector **psim, /* solution vectors */
ks_param *ksp, /* the offsets */
int num_offsets, /* number of offsets */
quark_invert_control qic[],
imp_ferm_links_t *fn_multi[] /* Storage for fermion links */
)
{
int i,multi_iters=0,iters=0;
#if defined(HALF_MIXED) && !defined(USE_CG_GPU)
/* Do multicg in single precision. (The GPU routine does this automatically for HALF_MIXED) */
int prec_save = qic[0].prec;
qic[0].prec = 1;
Real resid_save = qic[0].resid;
Real relresid_save = qic[0].relresid;
Real single_prec_resid = 1e-6;
Real single_prec_relresid = 1e-4;
if ( resid_save !=0 && resid_save < single_prec_resid)
qic[0].resid = single_prec_resid;
if ( relresid_save != 0 && relresid_save < single_prec_relresid)
qic[0].relresid = single_prec_relresid;
// node0_printf("Using HALF-MIXED CG; resid = %e\n", qic[0].resid);
#endif
/* First we invert as though all masses took the same Naik epsilon */
multi_iters = iters =
ks_multicg_offset_field( src, psim, ksp, num_offsets, qic, fn_multi[0]);
report_status(qic+0);
#if defined(HALF_MIXED) && !defined(USE_CG_GPU)
qic[0].prec = prec_save;
qic[0].resid = resid_save;
qic[0].relresid = relresid_save;
#endif
/* Then we refine using the correct Naik epsilon */
for(i=0;i<num_offsets;i++){
#ifdef NO_REFINE
if(fn_multi[i] == fn_multi[0])
continue;
#endif
ks_congrad_field_cpu( src, psim[i], qic+i, 0.5*sqrt(ksp[i].offset), fn_multi[i] );
iters += qic[i].final_iters;
qic[i].final_iters += multi_iters;
}
return iters;
}
开发者ID:lattice,项目名称:milc,代码行数:56,代码来源:ks_multicg.c
示例18: git_receive_pack
static int git_receive_pack(buffer_t in_buf, buffer_t out_buf,
buffer_t err_buf, void* payload) {
struct git_receive_pack_data* data = (struct git_receive_pack_data*)payload;
int result;
if (buffer_get_size(out_buf) > 0 || buffer_get_size(err_buf) > 0) {
// You still have pending write-data, wait until everything is written back
// to the client
return 1;
}
do {
switch (data->current_process) {
case p_receive_pack_reference_discovery:
log_debug("reference discovery on %s", data->repository);
result = reference_discovery(data->repository, process_receive_pack,
out_buf, err_buf,
libgit2_reference_discovery_cb);
break;
case p_receive_pack_update_request:
log_debug("update request on %s", data->repository);
result = update_request(data->repository, in_buf);
break;
case p_receive_pack_report_status:
log_debug("report status on %s", data->repository);
result = report_status(data->repository, out_buf);
break;
default:
log_err("Unsupported process requested: %i", data->current_process);
result = -1;
break;
}
if (result == 0 || result == 3) {
// Sucess, switch to next sub-process
data->current_process++;
}
} while (result == 3); // result of 3 means, that the next-process should
// be executed immediately. Don't wait for new
// input-data.
if (result == 0) { // Success
if (data->current_process < p_receive_pack_finished) {
// (Sub-process) finished, but there's at least another pending process.
result = 1;
}
} else if (result == 2) { // Success, but don't execute another sub-process
data->current_process = p_receive_pack_finished;
result = 0;
}
return result;
}
开发者ID:drobin,项目名称:grs,代码行数:53,代码来源:git.c
示例19: process_command
/* process command within a request
*/
static int
process_command( int new_sockfd, struct server_ctx* ctx,
const char* param, size_t plen )
{
int rc = 0;
const int STAT_OPTIONS = 0;
const int RESTART_OPTIONS = MSO_SKIP_CLIENTS | MSO_RESTART;
assert( (new_sockfd > 0) && ctx && param );
if( 0 == strncmp( ctx->cmd, CMD_UDP, sizeof(ctx->cmd) ) ||
0 == strncmp( ctx->cmd, CMD_RTP, sizeof(ctx->cmd) ) ) {
if( ctx->clfree ) {
rc = udp_relay( new_sockfd, param, plen,
&(ctx->mcast_inaddr), ctx );
}
else {
send_http_response( new_sockfd, 401, "Bad request" );
(void)tmfprintf( g_flog, "Client limit [%d] has been reached.\n",
ctx->clmax);
}
}
else if( 0 == strncmp( ctx->cmd, CMD_STATUS, sizeof(ctx->cmd) ) ) {
rc = report_status( new_sockfd, ctx, STAT_OPTIONS );
}
else if( 0 == strncmp( ctx->cmd, CMD_RESTART, sizeof(ctx->cmd) ) ) {
(void) report_status( new_sockfd, ctx, RESTART_OPTIONS );
terminate_all_clients( ctx );
wait_all( ctx );
}
else {
TRACE( (void)tmfprintf( g_flog, "Unrecognized command [%s]"
" - ignoring.\n", ctx->cmd) );
send_http_response( new_sockfd, 401, "Unrecognized request" );
}
return rc;
}
开发者ID:avble,项目名称:udpxy,代码行数:41,代码来源:udpxy.c
示例20: service_main
/**
* The main function for the service.
* Called by the services API when starting on windows in background.
* Arguments could have been present in the string 'path'.
* @param argc: nr args
* @param argv: arg text.
*/
static void
service_main(DWORD ATTR_UNUSED(argc), LPTSTR* ATTR_UNUSED(argv))
{
struct cfg* cfg = NULL;
struct svr* svr = NULL;
service_status_handle = RegisterServiceCtrlHandler(SERVICE_NAME,
(LPHANDLER_FUNCTION)hdlr);
if(!service_status_handle) {
reportev("Could not RegisterServiceCtrlHandler");
return;
}
service_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
service_status.dwServiceSpecificExitCode = 0;
/* we are now starting up */
report_status(SERVICE_START_PENDING, NO_ERROR, 3000);
if(!service_init(&svr, &cfg)) {
reportev("Could not service_init");
report_status(SERVICE_STOPPED, NO_ERROR, 0);
return;
}
/* event that gets signalled when we want to quit */
service_stop_event = WSACreateEvent();
if(service_stop_event == WSA_INVALID_EVENT) {
log_err("WSACreateEvent: %s", wsa_strerror(WSAGetLastError()));
reportev("Could not WSACreateEvent");
report_status(SERVICE_STOPPED, NO_ERROR, 0);
return;
}
if(!WSAResetEvent(service_stop_event)) {
log_err("WSAResetEvent: %s", wsa_strerror(WSAGetLastError()));
}
wsvc_setup_worker(svr->base);
/* SetServiceStatus SERVICE_RUNNING;*/
report_status(SERVICE_RUNNING, NO_ERROR, 0);
verbose(VERB_QUERY, "winservice - init complete");
/* register DHCP hook and perform first sweep */
netlist_start(svr);
/* daemon performs work */
svr_service(svr);
/* exit */
verbose(VERB_ALGO, "winservice - cleanup.");
report_status(SERVICE_STOP_PENDING, NO_ERROR, 0);
netlist_stop();
wsvc_desetup_worker();
service_deinit(svr, cfg);
free(service_cfgfile);
if(service_stop_event) (void)WSACloseEvent(service_stop_event);
verbose(VERB_QUERY, "winservice - full stop");
report_status(SERVICE_STOPPED, NO_ERROR, 0);
}
开发者ID:f-cap,项目名称:dnssec-trigger,代码行数:65,代码来源:win_svc.c
注:本文中的report_status函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论