MCPcopy Create free account
hub / github.com/boostorg/build / cmd_sem_lock

Function cmd_sem_lock

src/engine/make1.cpp:1446–1478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1444#ifdef OPT_SEMAPHORE
1445
1446static int32_t cmd_sem_lock( TARGET * t )
1447{
1448 CMD * cmd = (CMD *)t->cmds;
1449 TARGETS * iter;
1450 /* Check whether all the semaphores required for updating
1451 * this target are free.
1452 */
1453 for ( iter = cmd->lock; iter; iter = iter->next )
1454 {
1455 if ( iter->target->asynccnt > 0 )
1456 {
1457 if ( DEBUG_EXECCMD )
1458 out_printf( "SEM: %s is busy, delaying launch of %s\n",
1459 object_str( iter->target->name ), object_str( t->name ) );
1460 iter->target->parents = targetentry( iter->target->parents, t );
1461 return 0;
1462 }
1463 }
1464 /* Lock the semaphores. */
1465 for ( iter = cmd->lock; iter; iter = iter->next )
1466 {
1467 ++iter->target->asynccnt;
1468 if ( DEBUG_EXECCMD )
1469 out_printf( "SEM: %s now used by %s\n", object_str( iter->target->name
1470 ), object_str( t->name ) );
1471 }
1472 /* A cmd only needs to be locked around its execution.
1473 * clearing cmd->lock here makes it safe to call cmd_sem_lock
1474 * twice.
1475 */
1476 cmd->lock = NULL;
1477 return 1;
1478}
1479
1480static void cmd_sem_unlock( TARGET * t )
1481{

Callers 2

make1cFunction · 0.85
cmd_sem_unlockFunction · 0.85

Calls 3

out_printfFunction · 0.85
object_strFunction · 0.85
targetentryFunction · 0.85

Tested by

no test coverage detected