异步和同步在八度之间的区别? [英] Difference between async and sync in octave?
问题描述
I was having issues with the editor in octave and posted an question before: Octave output buffer completely messed up on OS X. How to fix?
我解决问题的方式是使用edit mode sync
而不是默认的async
.但是,我不太了解async
和sync
有什么区别?为什么在使用async
时,键盘同时向八度和编辑器发送信号,从而使输出缓冲区混乱?如果可能,我们可以对Macbook使用异步模式吗? (因为在我的linux计算机上一切正常,所以可以)
The way how I fixed the question is using edit mode sync
instead of the default async
. However, I don't really understand what's the difference between async
and sync
here? And why when using async
the keyboard was sending signals to both octave and the editor so that the output buffer gets messed up? If possible, can we use async mode for macbook? (Since everything works fine on my linux computer)
推荐答案
根据"edit()"的帮助文本:
According to the help text of `edit()':
[...]异步模式(编辑器在后台启动,八度继续)或同步模式(八度等待直到编辑器退出). [...](另请参见系统").
[...] async mode (editor is started in the background and Octave continues) or sync mode (Octave waits until the editor exits). [...] (see also "system").
它基本上定义了开始其他过程后发生的情况(在您的情况下为emacs).想想edit()
是如何设计的.您将出现在Octave提示符下,并使用它在文本编辑器中打开功能文件.您仍在使用八度提示时对文件进行更改.这是async
模式.
It basically defines what happens after starting the other process (emacs in your case). Think how edit()
was designed to be used. You are at the Octave prompt and use it to open a function file in your text editor. You make changes to the file while still using the Octave prompt. That's async
mode.
但是,您的文本编辑器没有GUI.启动emacs时,可以在调用它的同一终端窗口中使用它.因为已将其设置为async
,所以最终在同一终端中同时使用了emacs和Octave交互.将其设置为sync
意味着在退出emacs之前,Octave只是在等待,因此不会弄乱正在显示的内容.
However, your text editor does not a have a GUI. When you start emacs, you use it on the same terminal window where you called it from. Because you have it set to async
, you end up with both emacs and Octave interactive in the same terminal. Set it to sync
means that until you exit emacs, Octave is just waiting so it doesn't mess up with what's being displayed.
您可以:
- 使用带有GUI的文本编辑器;
- 更改您的EDITOR命令以打开一个新终端,然后在此处启动CLI emacs.例如,如果您使用的是gnome-terminal,则可以将其设置为
gnome-terminal -e emacs %s
; - 更改模式以进行同步.
- use a text editor with a GUI;
- change your EDITOR command to open a new terminal, and start your CLI emacs there. For example, if you are using gnome-terminal, you can set it to
gnome-terminal -e emacs %s
; - change mode to sync.
这篇关于异步和同步在八度之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!