[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

AbortProc question...

Posted on 1998-01-22
5
Medium Priority
?
259 Views
Last Modified: 2013-11-20
How can i implement an "AbortProc" callback function to a very long process? code avaliable?

Thanx in advance.
Mário Guedes
0
Comment
Question by:mguedes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 

Author Comment

by:mguedes
ID: 1314544
Edited text of question
0
 
LVL 2

Expert Comment

by:anichini
ID: 1314545
i dunno if this is what you want, but it'll work.

class Callback
{
public:
  virtual bool operator()(int progress, int total)=0;
};

class VeryLongProcess
{
public:
    VeryLongProcess(Callback *pCB) : m_pCB(pCB {}

    void doit();
private:
    Callback *m_pCB;
};


void VeryLongProcess::doit()
{
    for(int i = 0; i < VLP_ITERATIONS; i++)
    {
        if(!(i&0x7f)) // every 128 iterations
        {
          if(!(*m_pCB)(i, VLP_ITERATIONS))
          {
            break; // abort
          }
        }
        // ... do actual work here
    }

    if (i != VLP_ITERATIONS)
    {
      // we aborted, do abort cleanup
    }
}

0
 

Author Comment

by:mguedes
ID: 1314546
thanx anichini, this help´s me.
0
 
LVL 2

Accepted Solution

by:
anichini earned 30 total points
ID: 1314547
the answer is above.

0
 

Author Comment

by:mguedes
ID: 1314548
Thanx again, anichini
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question