On Mon, Feb 25, 2013 at 09:27:24PM -0300, Thiago Padilha wrote: > Command that provides features for all synchronization needs in tmux scripts.
I can't apply this with git-apply. > 1- When unlocking waiting panes, I guess it should be done in the > event loop, however I was getting random crashes when doing that, so Yes it should. I'd have to see what you tried to say why it was crashing. > now everything is done synchronously inside the command. > 2- It must take action when a pane that is holding the monitor exits, > but I couldn't figure out how to do it In the server loop. > +enum monitor_options { This should go in tmux.h Note also in the general case you need to read OpenBSD style(9): http://www.openbsd.org/cgi-bin/man.cgi?query=style&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html No C99 comments, no static functions, etc. > + MONITOR_ENQUEUE = 1, > + // if this is set, as soon as the pane acquires the lock, it will > + // temporarily give up the lock rights and be put on the wait stack > until > + // a signal is received, at which point it will be put back in front > + // of the lock queue again > + MONITOR_WAIT = 2, > + MONITOR_SIGNAL = 4, > + // if the pane is not holding the lock when it starts waiting for a > signal, > + // then this flag is set, which means that as soon as the the signal > + // arrives, it will leave the wait stack and release the lock > + MONITOR_RELEASE = 8 > +}; > + > +// queue of panes, used for tracking panes waiting to lock the monitor, or to > +// receive a signal from another pane > +struct cmdq_node { Again; in tmux.h, but why isn't this factored in to struct window_pane? > + > +// name, and the monitor node only exists while there's some pane using it > +struct monitor_node { This in tmux.h > + > + // monitor name > + char *name; > + > + // client/pane id > + int pane_id; > + > + // number of times the pane has locked the monitor. > + int count; > + > + SIMPLEQ_HEAD(, cmdq_node) lock_queue; // panes waiting to lock the > monitor We use either TAILQ or SLIST, RB_TREE, etc. Not SIMPLEQ_HEAD. Until I can mess around with this, I've superficial comments only. -- Thomas Adam ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users