BaseBot::~BaseBot() { if ( m_tcpip_client_started ) { // dcsp_stop(); } close_logs(); }
/// \brief This function is called once when our plugin is unloaded. We need /// to tell maya which mel funcs, nodes etc we are removing. /// \param obj - a handle to the loaded plugin /// \return an MStatus error code /// EXPORT MStatus uninitializePlugin( MObject obj) { _LogFunctionCall("uninitializePlugin()"); MStatus status; MFnPlugin plugin( obj ); // //status = plugin.deregisterNode( btSPHContext::typeId ); //IfMErrorMsgReturn(status, "deregist btSPHContext error.", status); // //// status = plugin.deregisterNode( btSPHNode::typeId ); IfMErrorMsgReturn(status, "deregist btSPHNode error.", status); //// //status = plugin.deregisterNode( simpleFluidEmitter::typeId ); //IfMErrorMsgReturn(status, "deregist simpleFluidEmitter error.", status); //// //status = plugin.deregisterNode( torusField::typeId ); //IfMErrorMsgReturn(status, "deregist torusField error.", status); // // status = plugin.deregisterNode( particleAttrNode::typeId ); IfMErrorMsgReturn(status, "deregist particleAttrNode error.", status); // status = plugin.deregisterCommand( btSPHCmd::typeName ); IfMErrorMsgReturn(status, "deregist btSPHCmd error.", status); // status = plugin.deregisterNode( btSPHMgrNode::typeId ); IfMErrorMsgReturn(status, "deregist btSPHMgrNode error.", status); // MGlobal::executeCommand("source \"SPHMain.mel\"; g_btSPH_End();"); close_logs(); return status; }
int main(int argc, char *argv[]) { int server_s; /* aspis socket */ pid_t pid; /* set umask to u+rw, u-x, go-rwx */ /* according to the man page, umask always succeeds */ umask(077); /* but first, update timestamp, because log_error_time uses it */ (void) time(¤t_time); /* set timezone right away */ tzset(); { int devnullfd = -1; devnullfd = open("/dev/null", 0); /* make STDIN point to /dev/null */ if (devnullfd == -1) { DIE("can't open /dev/null"); } if (dup2(devnullfd, STDIN_FILENO) == -1) { DIE("can't dup2 /dev/null to STDIN_FILENO"); } (void) close(devnullfd); } parse_commandline(argc, argv); fixup_server_root(); read_config_files(); drop_privs1(); set_root(); create_common_env(); open_logs(); server_s = create_server_socket(); init_signals(); build_needs_escape(); /* background ourself */ if (do_fork) { pid = fork(); } else { pid = getpid(); } switch (pid) { case -1: /* error */ perror("fork/getpid"); exit(EXIT_FAILURE); case 0: /* child, success */ break; default: /* parent, success */ if (pid_file != NULL) { FILE *PID_FILE = fopen(pid_file, "w"); if (PID_FILE != NULL) { fprintf(PID_FILE, "%d", pid); fclose(PID_FILE); } else { perror("fopen pid file"); } } if (do_fork) exit(EXIT_SUCCESS); break; } drop_privs2(); /* main loop */ timestamp(); status.requests = 0; status.errors = 0; start_time = current_time; loop(server_s); close_logs(); return 0; }