"Unhandled exception" error when using a loop inside thread

1

I got this error

Unhandled exception at 0x0049b946 in Program.exe: 0xC0000005: Access violation reading location 0x00000090.

and the error points to this line:

        // thread.hpp ln 56
        void run()
        {
            f(); // here <<
        }

When trying to run this code:

void frameFunc()
{
    for(;;)
    {
         //..........do something. it is too long to paste. (calculations)
    }
}

int main()
{
   boost::thread framethread(frameFunc);
   framethread.join();
   //........
}

The error will simply gone when I remove the loop in frameFunc.

Any kind of help would be appreciated :)

c++
boost
multithreading
asked on Stack Overflow Mar 24, 2010 by drowneath • edited Mar 24, 2010 by drowneath

1 Answer

2

The code that you showed looks valid. I think the problem is inside the code that is not shown.

answered on Stack Overflow Mar 24, 2010 by Brian R. Bondy

User contributions licensed under CC BY-SA 3.0