Difference between async and sync in octave?

天大地大妈咪最大 提交于 2019-12-11 19:23:02

问题


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?

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)


回答1:


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").

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.

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.

You can:

  1. use a text editor with a GUI;
  2. 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;
  3. change mode to sync.


来源:https://stackoverflow.com/questions/18192498/difference-between-async-and-sync-in-octave

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!