From 4e56fe682e6ad34c161aa40c06af4e3e0088962e Mon Sep 17 00:00:00 2001 From: Samo Penic <samo.penic@gmail.com> Date: Fri, 22 Nov 2013 19:29:14 +0000 Subject: [PATCH] Testing of paralel algorithm with mutexes and tainting. Still no success. It seems tainting and untainting does not works as suspected --- src/vertex.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/vertex.c b/src/vertex.c index 1993856..9fc96be 100644 --- a/src/vertex.c +++ b/src/vertex.c @@ -315,32 +315,31 @@ ts_bool vertex_taint(ts_vertex *vtx, ts_uint level){ - if(level==0){ - vtx->locked++; + ts_uint i; + vtx->locked++; //lock current vertex + if(level==0){ //if we reach last in recursion exit return TS_SUCCESS; } - ts_uint i; - for(i=0; i<vtx->neigh_no; i++){ + for(i=0; i<vtx->neigh_no; i++){ //else recursive call self with decreased level vertex_taint(vtx->neigh[i], level-1); } - vtx->locked++; return TS_SUCCESS; } ts_bool vertex_untaint(ts_vertex *vtx, ts_uint level){ - if(level==0){ vtx->locked--; + if(level==0){ return TS_SUCCESS; } ts_uint i; for(i=0; i<vtx->neigh_no; i++){ vertex_untaint(vtx->neigh[i], level-1); } - vtx->locked--; return TS_SUCCESS; } inline ts_bool vertex_tainted(ts_vertex *vtx, ts_uint level, ts_uint amount){ if(vtx->locked>amount) return 1; - else return 0; + + return 0; } -- Gitblit v1.9.3