I am writting code in C90 and using cilkplus. I use a library which define TRY, CATCH macros to simulate the try catch behaviour similar to C++. Now the following piece of code compiles and runs as expected:
int j ;
for ( j=0; j<some_constant; ++j)
{
TRY {
//some code which throws exception
} CATCH(SQLException) {
//some action.
}
END_TRY;
}
but when the same code is run wth cilk_for keword, I get compile error
The code:
int j ;
cilk_for ( j=0; j<some_constant; ++j)
{
TRY {
//some code which throws exception
} CATCH(SQLException) {
//some action.
}
END_TRY;
}
Error:
main.c: In function __cilk_for_001:
main.c:459:4: error: Can not spawn call to function that returns twice
line 459 is the end of scope for cilk_for loop.
I know that we are allowed to use try catch in C++ code so I even tried C++ but therre also the compiler gave the same error message.
Any help appriciated!!
Thanks.
Additional information:
The macros are defined in databse connection pooling library libzdb written in c.





