bool IStateStore::SaveToFile( const wxString& fileName ) { STOPWATCH_BEGIN; wxFileOutputStream stream( mMyTemporary ); bool res = false; if (stream.IsOk()) { wxBusyInfo info("Saving, please wait..."); res = SaveToStream( stream ); stream.Close(); if (res) { res = this->RenameTemporary( fileName ); } } else { wxLogError(wxString::Format("%s::SaveToFile: can't create temporary file (%s) to save data!", mMyName, mMyTemporary)); } STOPWATCH_END(wxString("IStateStore::SaveToFile ").Append(fileName)); return res; }
/* * do_IRQ() * Primary interface for handling IRQ() requests. * * This function is force executed when the PIC switches a thread to it. */ asmlinkage void do_IRQ(struct pt_regs *regs, unsigned int irq) { struct pt_regs *oldregs; struct thread_info *ti = current_thread_info(); STOPWATCH_DECLARE; trace_hardirqs_off(); /* * Mark that we are inside of an interrupt and * that interrupts are disabled. */ oldregs = set_irq_regs(regs); ti->interrupt_nesting++; irq_kernel_stack_check(irq, regs); /* * Start the interrupt sequence */ irq_enter(); /* * Execute the IRQ handler and any pending SoftIRQ requests. */ BUG_ON(!irqs_disabled()); STOPWATCH_START(); generic_handle_irq(irq); STOPWATCH_END(&irq_watches[irq]); BUG_ON(!irqs_disabled()); /* * Exit the interrupt and process softirqs if needed. */ STOPWATCH_START(); irq_exit(); STOPWATCH_END(&irq_watches[INTERRUPT_COUNT]); BUG_ON(!irqs_disabled()); /* * Outside of an interrupt (or nested exit). */ trace_hardirqs_on(); ti->interrupt_nesting--; set_irq_regs(oldregs); }
bool IStateStore::LoadFromFile( const wxString& fileName, bool useMemory /* true */ ) { STOPWATCH_BEGIN; wxFileInputStream stream(fileName); bool res = false; void* block = NULL; if (stream.IsOk()) { wxBusyInfo info("Loading, please wait..."); if (useMemory) { size_t size = stream.GetSize(); block = malloc(size); stream.Read( block, size ); res = LoadFromStream( wxMemoryInputStream(block, size) ); } else { res = LoadFromStream( stream ); } } else { wxLogError(wxString::Format("%s::LoadFromFile: can't open file (%s) to read data!", mMyName, fileName)); } if (block) { free(block); } STOPWATCH_END(wxString("IStateStore::LoadFromFile ").Append(fileName)); return res; }