On 09/06/2011 01:40 AM, Jacky Liu wrote:
Hi everyone

I need multi-threading in Vim because I need some work being done
under the desk without turning Vim into a "zombie", now I know Vim is
single-threaded, so I decided to give Python a try, demonstration:

        " x-bug.vim

        python3<<  EOF

        import threading
        import time

        print('thread 1')

        def print_to_vim():
                print('thread 2')

        threading.Thread(name='test', target=print_to_vim).start()

        print('thread 1 again')

        time.sleep(3)

        EOF


I know the problem. The following code works well:

" x-bug.vim

python << EOF

import threading
import time

print('thread 1')

def print_to_vim():
    print('thread 2')

a = threading.Thread(target=print_to_vim, args=())

a.daemon = False

print('thread 1 again')

time.sleep(3)

EOF


-- Hong

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to