import mfhclient
import os
import Queue
import sys
import threading
import trigger
import update


def main():
    q = Queue.Queue()
    updateq = Queue.Queue()
    mfhclient_thread = threading.Thread(
        args=(q,),
        name="mfhclient_thread",
        target=mfhclient.main,
        )
    mfhclient_thread.start()
    trigger_thread = threading.Thread(
        args=(updateq,),
        name="trigger_thread",
        target=trigger.trigger,
        )
    trigger_thread.start()
    count = 0
    while True:
        if updateq.empty() and updateq.get() == "update":
            q.put("quit")
        if not mfhclient_thread.is_alive():
            updater_thread = threading.Thread(
                args=("origin", "master"),
                name="updater_thread",
                target=update.pull,
                )
            updater_thread.start()
            updater_thread.join()
            sys.stdout.flush()
            os.execl(sys.executable, sys.executable, *sys.argv)
        count += 1

if __name__ == '__main__':
    main()

@@ -4,25 +4,18 @@
 ort 
-mfhclient
+os
 %0Aimport 
 os%0Ai
@@ -6,25 +6,26 @@
 t os%0Aimport 
-o
+sy
 s%0Aimport Que
@@ -25,69 +25,114 @@
 ort 
-Queue%0Aimport sys%0Aimport threading%0Aimport trigger%0A
+time%0Afrom multiprocessing import Process, Event%0A%0Aimport mfhclient%0Aimport update%0Afrom arguments 
 import 
-updat
+pars
 e%0A%0A%0A
@@ -155,89 +155,47 @@
 q = 
-Queue.Queue()%0A    updateq = Queue.Queue()%0A    mfhclient_thread = threading.Thread
+Event()%0A    mfhclient_process = Process
 (%0A  
@@ -206,16 +206,22 @@
   args=(
+args, 
 q,),%0A   
@@ -241,22 +241,23 @@
 hclient_
-thread
+process
 %22,%0A     
@@ -306,22 +306,23 @@
 hclient_
-thread
+process
 .start()
@@ -338,33 +338,25 @@
 ger_
-thread = threading.Thread
+process = Process
 (%0A  
@@ -367,22 +367,16 @@
   args=(
-update
 q,),%0A   
@@ -394,22 +394,23 @@
 trigger_
-thread
+process
 %22,%0A     
@@ -419,23 +419,22 @@
  target=
-trigger
+update
 .trigger
@@ -457,22 +457,23 @@
 trigger_
-thread
+process
 .start()
@@ -481,132 +481,40 @@
     
-count = 0%0A    while True:%0A        if updateq.empty() and updateq.get() == %22update%22:%0A            q.put(%22quit%22)%0A        if not
+trigger_process.join()%0A    while
  mfh
@@ -520,22 +520,23 @@
 hclient_
-thread
+process
 .is_aliv
@@ -552,256 +552,72 @@
     
-    updater_thread = threading.Thread(%0A                args=(%22origin%22, %22master%22),%0A                name=%22updater_thread%22,%0A                target=update.pull,%0A                )%0A            updater_thread.start()%0A            updater_thread.join()%0A    
+time.sleep(5)%0A    else:%0A        update.pull(%22origin%22, %22master%22)%0A
     
@@ -647,20 +647,16 @@
         
-  
-  
 os.execl
@@ -702,27 +702,8 @@
 rgv)
-%0A        count += 1
 %0A%0Aif
@@ -727,16 +727,57 @@
 ain__':%0A
+    # Parse arguments%0A    args = parse()%0A
     main

Switch from multithreading to multiprocessing