Changeset 637 for trunk/libs/libpthread/pthread.c
- Timestamp:
- Jul 18, 2019, 2:06:55 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/libpthread/pthread.c
r619 r637 230 230 231 231 //////////////////////////////////////////////////////////////////////////////////////////// 232 // The following functions define another implementation for the POSX barrier 233 // based on a distributed quadtree implemented in user space, and relying 234 // on a busy waiting policy. 235 //////////////////////////////////////////////////////////////////////////////////////////// 236 237 238 //////////////////////////////////////////////////////////////////////////////////////////// 239 // This recursive function initializes the SQT nodes 240 // traversing the SQT from root to bottom 241 //////////////////////////////////////////////////////////////////////////////////////////// 242 static void sqt_barrier_build( pthread_barrier_t * barrier, 232 // The following functions define another implementation for the POSX barrier, based on 233 // a distributed quad tree implemented in user space, but using a busy waiting policy. 234 //////////////////////////////////////////////////////////////////////////////////////////// 235 236 237 //////////////////////////////////////////////////////////////////////////////////////////// 238 // This recursive function initializes the DQT nodes traversing the SQT from root to bottom 239 //////////////////////////////////////////////////////////////////////////////////////////// 240 static void dqt_barrier_build( pthread_barrier_t * barrier, 243 241 unsigned int x, 244 242 unsigned int y, 245 243 unsigned int level, 246 sqt_node_t * parent,244 dqt_node_t * parent, 247 245 unsigned int x_size, 248 246 unsigned int y_size, … … 250 248 { 251 249 // get target node address 252 sqt_node_t * node = barrier->node[x][y][level];250 dqt_node_t * node = barrier->node[x][y][level]; 253 251 254 252 if (level == 0 ) // terminal case … … 266 264 267 265 #if PTHREAD_BARRIER_DEBUG 268 printf("\n[BARRIER] %s : sqt_node[%d][%d][%d] / arity %d / desc %x\n"266 printf("\n[BARRIER] %s : dqt_node[%d][%d][%d] / arity %d / desc %x\n" 269 267 "parent %x / child0 %x / child1 %x / child2 %x / child3 %x\n", 270 268 __FUNCTION__, x, y, level, node->arity, node, node->parent, … … 312 310 313 311 #if PTHREAD_BARRIER_DEBUG 314 printf("\n[BARRIER] %s : sqt_node[%d][%d][%d] / arity %d / desc %x\n"312 printf("\n[BARRIER] %s : dqt_node[%d][%d][%d] / arity %d / desc %x\n" 315 313 "parent %x / child0 %x / child1 %x / child2 %x / child3 %x\n", 316 314 __FUNCTION__, x, y, level, node->arity, node, node->parent, … … 322 320 { 323 321 if ( (cx[i] < x_size) && (cy[i] < y_size) ) 324 sqt_barrier_build( barrier,322 dqt_barrier_build( barrier, 325 323 cx[i], 326 324 cy[i], … … 332 330 } 333 331 } 334 } // end sqt_barrier_build()332 } // end dqt_barrier_build() 335 333 336 334 //////////////////////////////////////////////////////////////// … … 394 392 ( (l == 4) && ((x&0x0F) == 0) && ((y&0x0F) == 0) ) ) 395 393 { 396 sqt_node_t * node = remote_malloc( sizeof(sqt_node_t) , cxy );394 dqt_node_t * node = remote_malloc( sizeof(dqt_node_t) , cxy ); 397 395 398 396 if( node == NULL ) 399 397 { 400 printf("\n[ERROR] in %s : cannot allocate sqt_node in cluster %x\n",398 printf("\n[ERROR] in %s : cannot allocate dqt_node in cluster %x\n", 401 399 __FUNCTION__ , cxy ); 402 400 return -1; … … 411 409 412 410 // recursively initialize all SQT nodes from root to bottom 413 sqt_barrier_build( barrier,411 dqt_barrier_build( barrier, 414 412 0, 415 413 0, … … 428 426 ////////////////////////////////////////////////////////////////////////////////////////// 429 427 // This recursive function decrements the distributed "count" variables, 430 // traversing the SQT from bottom to root.428 // traversing the DQT from bottom to root. 431 429 // The last arrived thread reset the local node before returning. 432 430 ////////////////////////////////////////////////////////////////////////////////////////// 433 static void sqt_barrier_decrement( sqt_node_t * node )431 static void dqt_barrier_decrement( dqt_node_t * node ) 434 432 { 435 433 … … 457 455 { 458 456 // decrement the parent node if the current node is not the root 459 if ( node->parent != NULL ) sqt_barrier_decrement( node->parent );457 if ( node->parent != NULL ) dqt_barrier_decrement( node->parent ); 460 458 461 459 #if PTHREAD_BARRIER_DEBUG … … 484 482 return; 485 483 } 486 } // end sqt_barrier_decrement()484 } // end dqt_barrier_decrement() 487 485 488 486 /////////////////////////////////////////////////////// … … 504 502 505 503 // recursively decrement count from bottom to root 506 sqt_barrier_decrement( barrier->node[x][y][0] );504 dqt_barrier_decrement( barrier->node[x][y][0] ); 507 505 508 506 hal_user_fence();
Note: See TracChangeset
for help on using the changeset viewer.