On 04/15/2011 01:25 AM, roberto pagliari wrote:
> I am trying to use igraph within a c++ program. At some point I have a class
> method that looks like this
>
> /**** code ****/
> int Graph::gen_links() {
> igraph_t graph;
> igraph_empty(&graph, xy.size(), 0);
> if( save == true )
> links.clear();
>
> double h_sq, d;
> // generate links
> for(luint i = 0; i < xy.size(); i++)
> for(luint j = i+1; j < xy.size(); j++) {
> // generate |h|^2
> d = distance(i, j);
> if( d < d_crit )
> d = 1.0;
> h_sq = pow(mrand.randNorm(0, 1), 2.0) + pow(mrand.randNorm(0,
> 1), 2.0);
> if( h_sq * snr_lin / gamma_0_lin * pow(d, -alpha) >= 1 ) {
> igraph_add_edge(&graph, i, j);
> if( save == true )
> links.push_back( make_pair(i, j) );
> }
> }
> igraph_is_connected(&graph, &connected, IGRAPH_STRONG);
> igraph_destroy(&graph);
> return 1;
> }
> /*********************/
>
> The weird thing is that if I run a single-threaded simulation everything
> seems to be fine. If, instead, I use multithreading (where each thread has
> its own instance of Graph from which Graph::gen_links() is called) I get the
> following run-time errors.
>
> corrupt finally stack, popping 1 elements when only 0 left
> corrupt finally stack, popping 1 elements when only 0 left
> corrupt finally stack, popping 1 elements when only 0 left
> corrupt finally stack, popping 1 elements when only 0 left
> corrupt finally stack, popping 1 elements when only 0 left
> corrupt finally stack, popping 1 elements when only 0 left
> Assertion failed: (no>=0), function IGRAPH_FINALLY_REAL, file error.c, line 126.
> /Applications/NetBeans/NetBeans
> 6.9.1.app/Contents/Resources/NetBeans/ide/bin/nativeexecution/dorun.sh: line
> 33: 61152 Abort trap sh "${SHFILE}"
> Press [Enter] to close the terminal ...
>
> the problem appears to be related to igraph_add_edge. When removed I get no
> errors. Do you guys know what the problem could be?
>
> Thank you
>
>
>
>
> _______________________________________________