I wrote a Python script which use GCC and dockross to cross build an application on Windows and Linux. Because I want to speed up the time spending on building code, I use threading module to implement all four building processes (Linux and Windows, 32 and 64 bit).
But I found the two GCC building objects (for Linux 32 bit and 64 bit) are in a race condition. If I want to do the two buildings at the same time, some errors will occur, and the same situation happened on the dockcross building process.
The two dockcross building objects are in a race condition.
Are there any function or module I can use in Python for me to implement the two threads as a coupled thread, when one thread is finished, it will signal to its coupled thread to start?
Like the code below, I want the worker[0] and worker[1] have a signal mechanism and also between worker[2] and worker[3].
def main(): linux32_builder = builder( "linux32", "make CFLAGS=-m32 all", "./", "./", "/root/crossCompile/releaseFolder/") linux64_builder = builder( "linux64", "make all", "./", "./", "/root/crossCompile/releaseFolder/") win64_builder = builder( "win64", "dockcross-windows-x64 make all", "./", "./", "/root/crossCompile/releaseFolder/") win32_builder = builder( "win32", "dockcross-windows-x86 make all", "./", "./", "/root/crossCompile/releaseFolder/") # linux32_builder.copySourceCodeFromShare() Worker = [] Worker.append(Make_Thread(1, linux32_builder)) Worker.append(Make_Thread(2, linux64_builder)) Worker.append(Make_Thread(3, win64_builder)) Worker.append(Make_Thread(4, win32_builder)) for i in Worker: i.start() i.join()