make: Windows Jobserver
1
1 13.1.2 Windows Jobserver Interaction
1 ------------------------------------
1
1 On Windows systems the jobserver is implemented as a named semaphore.
1 The semaphore will be set with an initial count equal to the number of
1 available slots; to obtain a slot you must wait on the semaphore (with
1 or without a timeout). To release a slot, release the semaphore.
1
1 To access the semaphore you must parse the 'MAKEFLAGS' variable and
1 look for the argument string '--jobserver-auth=NAME' where 'NAME' is the
1 name of the named semaphore. Use this name with 'OpenSemaphore' to
1 create a handle to the semaphore.
1
1 There are various error conditions you must consider to ensure your
1 implementation is robust:
1
1 * Usually you will have a command-line argument controlling the
1 parallel operation of your tool. Consider whether your tool should
1 detect situations where both the jobserver and the command-line
1 argument are specified, and how it should react.
1
1 * Your tool should be sure to release the semaphore for the tokens it
1 read, even under error conditions. This includes not only errors
1 in your tool but also outside influences such as interrupts
1 ('SIGINT'), etc. You may want to install signal handlers to manage
1 this write-back.
1