void s_abort(int32 errno) { char *dumpflag, *getenv(); int32 coredump=0; #ifndef FTN90_IO void _cleanup(); #endif if (dumpflag = getenv("f77_dump_flag")) { coredump = up_low(*dumpflag) == 'y' ? 1 : 0; } if (coredump) { #ifndef FTN90_IO _cleanup(); #endif abort(); /* cause a core dump */ } else { #ifndef FTN90_IO _cleanup(); #endif fprintf(stderr,"*** Execution Terminated (%d) ***\n",errno); exit(errno); } }
void _cleanup(Tptr p) { if (p) { _cleanup(p->lokid); if (p->splitchar) { _cleanup(p->eqkid); } else { free(p->eqkid); /* It's just a string, free the memory */ } _cleanup(p->hikid); free(p); } }
abort_() { fprintf(stderr, "Fortran abort routine called\n"); f_exit(); _cleanup(); abort(); }
f77_abort( err_val, act_core ) { char first_char, *env_var; int core_dump; env_var = getenv("f77_dump_flag"); first_char = (env_var == NULL) ? 0 : *env_var; signal(SIGILL, SIG_DFL); sigsetmask(0); /* don't block */ /* see if we want a core dump: first line checks for signals like hangup - don't dump then. second line checks if -lg specified to ld (e.g. by saying -g to f77) and checks the f77_dump_flag var. */ core_dump = ((nargs() != 2) || act_core) && ( (_lg_flag && (first_char != 'n')) || first_char == 'y'); if( !core_dump ) fprintf(units[STDERR].ufd,"*** Execution terminated\n"); f_exit(); _cleanup(); if( nargs() ) errno = err_val; else errno = -2; /* prior value will be meaningless, so set it to undefined value */ if( core_dump ) abort(); else exit( errno ); }
void Server::RunUpdateLoop() { uint32 realCurrTime = 0; uint32 realPrevTime = GetMSTime(); uint32 prevSleepTime = 0; // used for balanced full tick time length while (_isRunning) { realCurrTime = GetMSTime(); uint32 diff = GetMSTimeDiff(realPrevTime, realCurrTime); _update(diff); realPrevTime = realCurrTime; // diff (D0) include time of previous sleep (d0) + tick time (t0) // we want that next d1 + t1 == _SLEEP_CONST // we can't know next t1 and then can use (t0 + d1) == _SLEEP_CONST requirement // d1 = _SLEEP_CONST - t0 = _SLEEP_CONST - (D0 - d0) = _SLEEP_CONST + d0 - D0 if (diff <= _SLEEP_CONST + prevSleepTime) { prevSleepTime = _SLEEP_CONST + prevSleepTime - diff; ACE_OS::sleep(ACE_Time_Value(0, static_cast<uint64>(prevSleepTime) * 1000L)); } else prevSleepTime = 0; } _cleanup(); }
static void _testDeliveryRetry(CIMClient &client) { try { cout << "Testing DeliveryRetry functionality..." << endl; _setup(client); _resetIdentfier(client); _testIndicationsWithListenerRunning(client); #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT _testIndicationsWithListenerNotRunning(client); // Run again the same test, this time SequenceNumber should change cout << "Test listener with next sequence ID..." << endl; _testIndicationsWithListenerNotRunning(client); _testRetryAttemptsExceededIndications(client); #endif _cleanup(client); #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT // There should not be any queues after cleanup Array<CIMInstance> queues = _getDestinationQueues(client); PEGASUS_TEST_ASSERT(queues.size() == 0); #endif } catch (Exception& e) { cerr << "Error: " << e.getMessage() << endl; exit(1); } }
void _cleanup(tree *root) { if (root == NULL) return; _cleanup(root->left); root->left = NULL; _cleanup(root->right); root->right = NULL; if (root->left == NULL && root->right == NULL) { free(root); return; } }
void Vm::startsWith(const byte* const beg, const byte* const end, const uint64_t startOffset, HitCallback hitFn, void* userData) { CurHitFn = hitFn; UserData = userData; const Instruction* base = &(*Prog)[0]; uint64_t offset = startOffset; if (Prog->First[*beg]) { for (ThreadList::const_iterator t(First.begin()); t != First.end(); ++t) { Active.emplace_back( #ifdef _MSC_VER Thread(t->PC, Thread::NOLABEL, offset, Thread::NONE) #else t->PC, Thread::NOLABEL, offset, Thread::NONE #endif ); } for (const byte* cur = beg; cur < end; ++cur, ++offset) { for (ThreadList::iterator t(Active.begin()); t != Active.end(); ++t) { _executeThread(base, t, cur, offset); } _cleanup(); if (Active.empty()) { // early exit if threads die out break; } } } closeOut(hitFn, userData); reset(); }
uint64_t Vm::search(const byte* const beg, const byte* const end, const uint64_t startOffset, HitCallback hitFn, void* userData) { CurHitFn = hitFn; UserData = userData; const Instruction* base = &(*Prog)[0]; const ByteSet& first = Prog->First; uint64_t offset = startOffset; for (const byte* cur = beg; cur < end; ++cur, ++offset) { #ifdef LBT_TRACE_ENABLED open_frame_json(std::clog, offset, cur); #endif _executeFrame(first, Active.begin(), base, cur, offset); #ifdef LBT_TRACE_ENABLED close_frame_json(std::clog, offset); #endif _cleanup(); } // std::cerr << "Max number of active threads was " << maxActive << ", average was " << total/(end - beg) << std::endl; // check for remaining live threads const ThreadList::const_iterator e(Active.end()); for (ThreadList::iterator t(Active.begin()); t != e; ++t) { const unsigned char op = t->PC->OpCode; if (op == HALT_OP || op == FINISH_OP) { continue; } // this is a live thread return t->Start; } return Thread::NONE; }
void DicomSurfaceSegmentationLoad::_updateOutputFields() { handleNotificationOff(); _outPointSetPositions.clear(); _outLineSetPositions.clear(); //_outLineSetConnections.clear(); _cleanup(); for (std::size_t i=0; i<_dicomPointSetsVector.size(); i++) { _addPointSetToOutput((int)i); } for (std::size_t i=0; i<_dicomLineSetsVector.size(); i++) { _addLineSetToOutput((int)i); } for (std::size_t i=0; i<_dicomMeshesVector.size(); i++) { _addMeshToOutput((int)i); } handleNotificationOn(); _outPointSetPositionsFld->touch(); _outLineSetPositionsFld->touch(); //_outLineSetConnectionsFld->touch(); _notifyObservers(); }
bool LocalNode::close() { if( _state != STATE_LISTENING ) return false; NodeStopPacket packet; send( packet ); EQCHECK( _receiverThread->join( )); _cleanup(); EQINFO << _incoming.getSize() << " connections open after close" << std::endl; #ifndef NDEBUG const Connections& connections = _incoming.getConnections(); for( Connections::const_iterator i = connections.begin(); i != connections.end(); ++i ) { EQINFO << " " << *i << std::endl; } #endif EQASSERTINFO( !hasPendingRequests(), *static_cast< base::RequestHandler* >( this )); return true; }
gint cmd_get(gint argc, gchar **argv) { struct setup_query_s sq; if (setup_opts(argc, argv, &lopts) != EXIT_SUCCESS) return (EXIT_FAILURE); if (lutil_parse_input(&linput, (const gchar**) opts.rargs) != EXIT_SUCCESS) return (EXIT_FAILURE); if (setup_quvi(&q) != EXIT_SUCCESS) { linput_free(&linput); return (EXIT_FAILURE); } memset(&sq, 0, sizeof(struct setup_query_s)); sq.force_subtitle_mode = opts.core.print_subtitles; sq.activity.playlist = _foreach_playlist_url; sq.activity.subtitle = _foreach_subtitle_url; sq.activity.media = _foreach_media_url; sq.perr = lutil_print_stderr_unless_quiet; sq.xperr = lprint_enum_errmsg; sq.linput = &linput; sq.q = q; sigwinch_setup(&saw, &sao); return (_cleanup(setup_query(&sq))); }
int _test(CIMClient& client, const char* opt, String& qlang) { if (String::equalNoCase (opt, "setup")) { _setup (client, qlang); } else if (String::equalNoCase (opt, "setup2")) { _setup2 (client, qlang); } else if (String::equalNoCase (opt, "create")) { _create (client); } else if (String::equalNoCase (opt, "create2")) { _create2 (client); } else if (String::equalNoCase (opt, "sendSucceed")) { _sendSucceed (client); } else if (String::equalNoCase (opt, "sendFail")) { _sendFail (client); } else if (String::equalNoCase (opt, "sendBlock")) { _sendBlock (client); } else if (String::equalNoCase (opt, "delete")) { _delete (client); } else if (String::equalNoCase (opt, "delete2")) { _delete2 (client); } else if (String::equalNoCase (opt, "cleanup")) { _cleanup (client); } else if (String::equalNoCase (opt, "cleanup2")) { _cleanup2 (client); } else { PEGASUS_STD (cerr) << "Invalid option: " << opt << PEGASUS_STD (endl); _usage (); return -1; } return 0; }
AlignedPODArray& operator = (AlignedPODArray&& tmp) { _cleanup(); _count = tmp._count; _sizeof = tmp._sizeof; _data = tmp._release_data(); _delete = tmp._delete; _dup = tmp._dup; return *this; }
void ABI_Collab_Export::masterInit() { UT_DEBUGMSG(("ABI_Collab_Export::masterInit()\n")); // NOTE: it's important that this function resets all state, as it can be // called in the middle of an already running collaboration session // (eg. when a session takeover happens) _cleanup(); _init(); }
void abort() { extern void _cleanup(); _cleanup(); (void)Sig_SetHoldMask(0, (int *)0); (void)Sig_Send(SIG_ILL_INST, PROC_MY_PID, FALSE); _exit(1); /* Never return to caller, even * if the debugger lets us continue. */ }
AlignedPODArray& operator = (const AlignedPODArray& that) { void* tmp_data = that._data_copy(); _cleanup(); _count = that._count; _sizeof = that._sizeof; _data = tmp_data; _delete = that._delete; _dup = that._dup; return *this; }
static VOID _unload ( PDRIVER_OBJECT DriverObject ) { _restoreKernelModules(); _cleanup(DriverObject->DeviceObject); return; }
McoStatus ScanSimpleCal::calibrate(long size, double *mea, double *ref) { McoStatus status; long i, j, k, m; double avg, max; int32 which; long calsize; //the number of patches used to calibrate double *desmea, *desref; double *cyanmea, *cyanref; //init _cleanup(); _num_data = size; //matrix computation Matrix matconv(3); double mat[9]; mat[0] = 0.5242/2.55; mat[1] = 0.3083/2.55; mat[2] = 0.1316/2.55; mat[3] = 0.2851/2.55; mat[4] = 0.6554/2.55; mat[5] = 0.0594/2.55; mat[6] = 0.0293/2.55; mat[7] = 0.1377/2.55; mat[8] = 0.6578/2.55; matconv.loadstruct(mat); matconv.inv(); status = matconv.get_status(); if(status != MCO_SUCCESS) return status; desmea = (double*)McoMalloc(sizeof(double)*_num_data*3); if(!desmea) return MCO_MEM_ALLOC_ERROR; desref = (double*)McoMalloc(sizeof(double)*_num_data*3); if(!desref) return MCO_MEM_ALLOC_ERROR; for(j = 0; j < _num_data*3; j++) { desmea[j] = mea[j]; desref[j] = ref[j]; } //create global calibration status = _globalcal(matconv, _num_data, desmea, ref); if(status != MCO_SUCCESS) return status; McoFree(desmea); McoFree(desref); return status; }
// num_skipped counts the number of reads that do not show up in output. Used by validate to account for all the input reads. b2g_error_t params2gasv_input(char *BAM_PATH, char *OUTPUT_PREFIX, int MAPPING_QUALITY, int WRITE_CONCORDANT, int WRITE_LOWQ, int LOW_MEMORY, int AMBIGUOUS, int LIB_SEP, int VERBOSE, int CUTOFF_X, int CUTOFF_Y, b2g_cutoff_lminlmax_mode_t CUTOFF_MODE, char *CUTOFF_NAME, int PROPER_LENGTH, int USE_NUMBER_READS, int DEBUG_LEVEL, int WRITE_SPLITREAD, int MIN_ALIGNED_PCT, char *CHROMOSOME_NAMING, b2g_platform_t PLATFORM, int VALIDATION_STRINGENCY, int GASV_PRO, int IGNORE_DUPLICATES, int QNAME_SORTED, int SPLIT_BY_CHROMOSOME, unsigned int *num_skipped) { assert(BAM_PATH && OUTPUT_PREFIX && in_range(MAPPING_QUALITY, 0, 255) && is_bool(WRITE_CONCORDANT) && is_bool(WRITE_LOWQ) && is_bool(LOW_MEMORY) && is_bool(AMBIGUOUS) && is_bool(LIB_SEP) && is_bool(VERBOSE) && CUTOFF_MODE && (FILENAME != CUTOFF_MODE || CUTOFF_NAME) && is_nonnegative(PROPER_LENGTH) && is_positive(USE_NUMBER_READS) && is_bool(WRITE_SPLITREAD) && in_range(MIN_ALIGNED_PCT, 50, 100) && is_bool(GASV_PRO) && is_bool(IGNORE_DUPLICATES) && is_bool(SPLIT_BY_CHROMOSOME)); b2g_error_t ERR = B2GERR_NO_ERROR; hash_t *pairtable = NULL; samfile_t *in = NULL, *lowq_file = NULL, *split_file = NULL; FILE *chromosome_naming_file = NULL, *cutoff_file = NULL, *info_file = NULL, *gasv_file = NULL, *gasvpro_file = NULL; unsigned long GENOME_LENGTH = DEFAULT_GENOME_LENGTH; if (GASV_PRO && !WRITE_CONCORDANT) { if (VERBOSE) printf("-WRITE_CONCORDANT is required for -GASVPRO output. Automatically enabling.\n\n"); WRITE_CONCORDANT = 1; } if (AMBIGUOUS && !QNAME_SORTED) { if (VERBOSE) printf("-QNAME_SORTED is required for -AMBIGUOUS output. Automatically enabling.\n\n"); QNAME_SORTED = 1; } if (FILENAME == CUTOFF_MODE && !LIB_SEP) { if (VERBOSE) printf("-LIB_SEP sep is required for -CUTOFF_LMINLMAX FILE=... output. Automatically enabling.\n\n"); LIB_SEP = 1; } if (AMBIGUOUS && (WRITE_LOWQ || WRITE_SPLITREAD)) { if (VERBOSE) printf("-WRITE_LOWQ and -WRITE_SPLITREAD behavior are undefined for -AMBIGUOUS. Automatically disabling\n\n"); WRITE_LOWQ = WRITE_SPLITREAD = 0; } // Open all external resources and abort if failure. if ((ERR = _open_files(&in, &chromosome_naming_file, &cutoff_file, &lowq_file, &split_file, &info_file, &gasv_file, &gasvpro_file, BAM_PATH, OUTPUT_PREFIX, CHROMOSOME_NAMING, CUTOFF_MODE, CUTOFF_NAME, WRITE_LOWQ, WRITE_SPLITREAD, GASV_PRO))) return _cleanup(in, chromosome_naming_file, cutoff_file, lowq_file, split_file, info_file, gasv_file, gasvpro_file, pairtable, ERR); // Allocate hash table struct stat st; stat(BAM_PATH, &st); if (!(pairtable = hash(!QNAME_SORTED * ((st.st_size / B2G_HASH_SIZE) / (LOW_MEMORY ? MAX_BAM_FILES : 1))))) return _cleanup(in, chromosome_naming_file, cutoff_file, lowq_file, split_file, info_file, gasv_file, gasvpro_file, pairtable, B2GERR_OUT_OF_MEMORY); // Calculate required space for bam_header metadata, int NUM_CHROMOSOMES, NUM_READGROUPS, NUM_LIBRARIES; b2g_bam_header_counts(in->header, &NUM_CHROMOSOMES, &NUM_READGROUPS, &NUM_LIBRARIES, &LIB_SEP, PROPER_LENGTH); // allocate memory for said data, b2g_cutoff_lminlmax_t cutoff_lminlmax = {CUTOFF_MODE, CUTOFF_X , CUTOFF_Y, CUTOFF_NAME}; int chromosome_numbers[NUM_CHROMOSOMES]; b2g_chromosomes_t chromosomes = {NUM_CHROMOSOMES, chromosome_numbers}; b2g_readgroup2library_t rgs2libs[NUM_READGROUPS]; b2g_library_t libs[NUM_LIBRARIES]; b2g_libraries_t libraries = {NUM_READGROUPS, NUM_LIBRARIES, &rgs2libs[0], &libs[0]}; // and read the header into that memory. if ((ERR = b2g_bam_header_read(in->header, &chromosomes, &libraries, &GENOME_LENGTH, cutoff_lminlmax, chromosome_naming_file, cutoff_file, LIB_SEP, USE_NUMBER_READS, PROPER_LENGTH, VERBOSE))) return _cleanup(in, chromosome_naming_file, cutoff_file, lowq_file, split_file, info_file, gasv_file, gasvpro_file, pairtable, ERR); // Do all the main program logic of splitting the bam file, sorting the contents, merging the final output, and dumping the statistics. if ((ERR = _split_sort_merge_dump(BAM_PATH, OUTPUT_PREFIX, MAPPING_QUALITY, WRITE_CONCORDANT, WRITE_LOWQ, LOW_MEMORY, AMBIGUOUS, LIB_SEP, VERBOSE, CUTOFF_X, CUTOFF_Y, CUTOFF_MODE, CUTOFF_NAME, PROPER_LENGTH, USE_NUMBER_READS, DEBUG_LEVEL, WRITE_SPLITREAD, MIN_ALIGNED_PCT, CHROMOSOME_NAMING, PLATFORM, GASV_PRO, IGNORE_DUPLICATES, lowq_file, split_file, &libraries, &chromosomes, pairtable, info_file, gasv_file, gasvpro_file, GENOME_LENGTH, QNAME_SORTED, SPLIT_BY_CHROMOSOME, num_skipped))) return _cleanup(in, chromosome_naming_file, cutoff_file, lowq_file, split_file, info_file, gasv_file, gasvpro_file, pairtable, ERR); return _cleanup(in, chromosome_naming_file, cutoff_file, lowq_file, split_file, info_file, gasv_file, gasvpro_file, pairtable, B2GERR_NO_ERROR); }
void MigrationChunkClonerSourceLegacy::cancelClone(OperationContext* txn) { invariant(!txn->lockState()->isLocked()); { stdx::lock_guard<stdx::mutex> sl(_mutex); if (_cloneCompleted) return; } _callRecipient(BSON(kRecvChunkAbort << _args.getNss().ns())); _cleanup(txn); }
static void _signal_handler(int sig) { int ret; assert(_progname != NULL && _end_result != NULL); /* Must output result here, b/c who knows where in the code we are * when we caught the signal */ ret = _end_result(_progname, _dest, _pkt_sent, _pkt_recv); _cleanup(); exit(ret); }
static void __exit(int quick, int dontexit, int errcode) { _lock_exit(); if (!quick) { /* Execute "atexit" functions */ if (__pCallAtExitProcs) __pCallAtExitProcs(); /* First run #pragma exit routines... */ _cleanup(); /* ... Then Flush files. */ (*_exitbuf)(); } else { /* Unhook the atexit handler function. Since quick was specified, we don't want any atexit procs called now, or later if we're using the RTLDLL. */ __pCallAtExitProcs = NULL; } if (!dontexit) { if (!quick) { (*_exitfopen)(); /* close stream files */ (*_exitopen)(); /* close handle files */ } _unlock_exit(); /* Optionally release virtual memory here */ #if defined(__MT__) /* These functions free the memory for the locks so the CG doesn't complain. */ _cleanup_handle_locks(); _cleanup_stream_locks(); #endif _terminate(errcode); /* terminate program */ } _unlock_exit(); }
void grid_task_queue_destroy(struct grid_task_queue_s *gtq) { if (!gtq) return; if (gtq->tasks) { _cleanup(gtq); g_array_free(gtq->tasks, TRUE); gtq->tasks = NULL; } if (gtq->name) { g_free(gtq->name); gtq->name = NULL; } g_free(gtq); }
void MigrationSourceManager::cleanupOnError(OperationContext* txn) { if (_state == kDone) { return; } grid.catalogClient(txn)->logChange(txn, "moveChunk.error", _args.getNss().ns(), BSON("min" << _args.getMinKey() << "max" << _args.getMaxKey() << "from" << _args.getFromShardId() << "to" << _args.getToShardId())); _cleanup(txn); }
void ipmi_ping_err_exit (char *fmt, ...) { char buf[IPMI_PING_MAX_ERR_LEN]; va_list ap; assert (pingtool_progname); assert (fmt); va_start (ap, fmt); snprintf (buf, IPMI_PING_MAX_ERR_LEN, "%s: %s\n", pingtool_progname, fmt); vfprintf (stderr, buf, ap); va_end (ap); _cleanup (); exit (EXIT_FAILURE); }
Status MigrationChunkClonerSourceLegacy::commitClone(OperationContext* txn) { invariant(!txn->lockState()->isLocked()); { stdx::lock_guard<stdx::mutex> sl(_mutex); invariant(!_cloneCompleted); } auto responseStatus = _callRecipient(createRecvChunkCommitRequest(_args.getNss(), _sessionId)); if (responseStatus.isOK()) { _cleanup(txn); return Status::OK(); } cancelClone(txn); return responseStatus.getStatus(); }
void hpx_finalize(void) { // clean up after _hpx_143 if (_hpx_143 != HPX_NULL) { hpx_gas_free(_hpx_143, HPX_NULL); } #if defined(HAVE_APEX) // this will add the stats to the APEX data set libhpx_save_apex_stats(); #endif _stop(here); #if defined(ENABLE_PROFILING) libhpx_stats_print(); #endif _cleanup(here); }
void ABI_Collab_Export::slaveInit(const UT_UTF8String& docUUID, UT_sint32 iRemoteRev) { UT_DEBUGMSG(("ABI_Collab_Export::slaveInit() - docUUID: %s, iRev: %d\n", docUUID.utf8_str(), iRemoteRev)); // NOTE: it's important that this function resets all state, as it can be // called in the middle of an already running collaboration session // (eg. when a session takeover happens) _cleanup(); _init(); // initialize the adjustment stack ChangeRecordSessionPacket voidPacket; voidPacket.setDocUUID(docUUID); voidPacket.setRev(iRemoteRev); m_pAbiCollab->addChangeAdjust(new ChangeAdjust(voidPacket, static_cast<PT_DocPosition>(0), docUUID)); }
static void _signal_handler (int sig) { int ret; assert (pingtool_progname); assert (pingtool_end_result); /* Must output result here, b/c who knows where in the code we are * when we caught the signal */ ret = pingtool_end_result (pingtool_progname, pingtool_dest, pingtool_pkt_sent, pingtool_pkt_recv); _cleanup (); exit (ret); }