Monday, September 5, 2011

The X bug with Gvim

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

The above code works fine with console Vim as it prints the intended
message while everything else look normal, but it would make Gvim
collapse every time it's been sourced, leaving this message:

gvim: Fatal IO error 11 (Resource temporarily unavailable) on X
server :0.0.

The problem seems to be with the X system. I did some more test and it
seems ok to have multiple Python threads in Gvim, but only one of
these threads is permitted to interact with the GUI (means to cause
any change of display within the Gvim program window)

Since I'm an ordinary user to both Vim and Python and don't know much
about the Unix System, can anyone please tell me:

1. Should this be considered a bug?

2. Is there any way to get around this, thus making it safe to have
several Python threads interacting with Gvim?

Thanks

--
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

No comments: