>
>
> On Sep 6, 1:40 am, Jacky Liu<bluegene8...@gmail.com> 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
>>
>> 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
>
>
> Please, isn't there anyone interested in this topic?
>
> I think doing multi-threading in Vim would find great use, like in
> Conque -- its current implementation is far from optimal. Follow this
> way down we may use Vim as an excellent UI for almost any text-based
> program there is (or going even further with non-text based programs
> if you like), and now this X-bug or whatsoever seems to be the biggest
> (if not last) obstacle.
>
> Anyone? Please tell me what you think.
>
> Besides, the vim doc had nothing on this topic, it didn't say that
> Python shouldn't go multi-threaded with Gvim. Should I try to post
> this in the vim_dev group?
>
I agree that better integration with Python, including multithreading,
would be the best new feature for Vim. I think the issue is that
it's not easy to do? At least, it ranks #2 in this list:
http://www.vim.org/sponsor/vote_results.php
And so far I don't think much was done in this respect, so here's
hoping for the future...
-ak
--
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:
Post a Comment