Lets say we have block of code, we just cant modify it, but we want to break it, exit this piece of code when it runs too long (x miliseconds)

Pseudo code

```
Throw exception after (500ms) {
    auto result = Do some risky job, for example test string by regex with catastrophic backtracking risk.
}
catch ( Exception e ) {
    //... 
}

```

Every thing has to be still in the same thread. 

Is it possible with c++11 or with some other standard?