How does it work when I run two ninja commands (the 2nd begins before the 1st completes) in the same directory. Will it cause undefined behaviors?

55 views
Skip to first unread message

刘铭名

unread,
Nov 30, 2021, 12:32:36 PM11/30/21
to ninja-build

Hi,

    I'm wondering how it works when I run two ninja commands (the 2nd begins before the 1st completes) in the same directory.

     The 1st one is still linking, but the 2nd one is re-building a target (that's possibly being used) in the 1st command anytime.

      I didn't see a violent warning message or error, so wondering if it would cause undefined behavior, or introduces bugs silently.


Mingming Liu

unread,
Dec 1, 2021, 2:21:14 PM12/1/21
to ninja-build
frt, https://stackoverflow.com/questions/70173482/how-does-it-work-when-i-run-two-ninja-commands-the-2nd-begins-before-the-1st-co/70173754#70173754 discussed the same question.

And to quote from the response, the short answer is
1) There is no blocking mechanism implemented in ninja to protect against concurrent execution
2) The behavior here will be a result of a race condition - two processes access, write and read, to the same set of files concurrently. That's nothing out of the ordinary

Reply all
Reply to author
Forward
0 new messages