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

Function cmd_sem_lock

v2/engine/make1.c:1390–1422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1388#ifdef OPT_SEMAPHORE
1389
1390static int cmd_sem_lock( TARGET * t )
1391{
1392 CMD * cmd = (CMD *)t->cmds;
1393 TARGETS * iter;
1394 /* Check whether all the semaphores required for updating
1395 * this target are free.
1396 */
1397 for ( iter = cmd->lock; iter; iter = iter->next )
1398 {
1399 if ( iter->target->asynccnt > 0 )
1400 {
1401 if ( DEBUG_EXECCMD )
1402 printf( "SEM: %s is busy, delaying launch of %s\n",
1403 object_str( iter->target->name ), object_str( t->name ) );
1404 iter->target->parents = targetentry( iter->target->parents, t );
1405 return 0;
1406 }
1407 }
1408 /* Lock the semaphores. */
1409 for ( iter = cmd->lock; iter; iter = iter->next )
1410 {
1411 ++iter->target->asynccnt;
1412 if ( DEBUG_EXECCMD )
1413 printf( "SEM: %s now used by %s\n", object_str( iter->target->name
1414 ), object_str( t->name ) );
1415 }
1416 /* A cmd only needs to be locked around its execution.
1417 * clearing cmd->lock here makes it safe to call cmd_sem_lock
1418 * twice.
1419 */
1420 cmd->lock = NULL;
1421 return 1;
1422}
1423
1424static void cmd_sem_unlock( TARGET * t )
1425{

Callers 2

make1cFunction · 0.85
cmd_sem_unlockFunction · 0.85

Calls 2

object_strFunction · 0.85
targetentryFunction · 0.85

Tested by

no test coverage detected