#include #include #include _Task_SetVar("Shared_Var",0) ConsoleWrite("Main Process PID: " & @AutoItPID & " -> Var is initialized with " & _Task_GetVar("Shared_Var") & @LF) local $PIDarray[2] $PIDarray[0]=_Task_Create("Write","Write_EXP") $PIDarray[1]=_Task_Create("Read","Read_EXP") _Task_join($PIDarray) ConsoleWrite("Main Process PID: " & @AutoItPID & " -> Var is now = " & _Task_GetVar("Shared_Var") & @LF) Func Write_EXP() $logFileMove = FileOpen(@ScriptDir & "\Tango.log", 1) $tempint=_Task_GetVar("Shared_Var") _FileWriteLog($logFileMove, "Task : "&@AutoItPID& " | I'm doing my job, please wait.") ; MODIFY THIS ; 600 IS OK ; 700 IS KO sleep(600) _Task_SetVar("Shared_Var",$tempint+1) _FileWriteLog($logFileMove, "Task : "&@AutoItPID& " | I just set var to " & $tempint+1 & " from " & $tempint ) FileClose($logFileMove) EndFunc Func Read_EXP() $logFileMove = FileOpen(@ScriptDir & "\Uranus.log", 1) While _Task_GetVar("Shared_Var") = 0 sleep(100) _FileWriteLog($logFileMove, "Task : "&@AutoItPID& " | I just get var " & _Task_GetVar("Shared_Var")) WEnd _FileWriteLog($logFileMove, "Task : "&@AutoItPID& " | I just get var " & _Task_GetVar("Shared_Var")) _FileWriteLog($logFileMove, "Task : "&@AutoItPID& " | Waiting is over") FileClose($logFileMove) EndFunc