reverseVideo from perl module
Marc Lehmann
schmorp at schmorp.de
Tue Aug 31 16:52:26 CEST 2010
On Tue, Aug 31, 2010 at 03:27:03PM +0200, Jochen Keil <jochen.keil at gmail.com> wrote:
> Cmd_parse("\033[?5h") respectively cmd_parse("\033[?5l") do the trick
> for me. However i'm having a problem with $self->refresh(). It doesn't
> happen instantly. The terminal only gets refreshed if I hit a key (it is
> not necessary that the terminal is focused though).
That's one of the problems you run into threads with. While you might be
able to hack around it, your plug-in is already prone to crash as it is
due to race conditions.
> The plugin works so far (for me), but I don't know how it would behave
> without threads.
It's broken with or without the windows process emulation ("threads").
> Writing it without threads would be tedious though
> since I'd have to use pipes (would a pipe in /tmp be portable anyway?).
I don't see why you would need to use a pipe - there are many exmaples of
using Net::DBus without any pipes.
For example AnyEvent::DBus let's you integrate dbus into urxvt, but you
could also register your own I/O watcher for dbus (note that Net::DBus
uses libdbus, which can freeze urxvt for long amounts of time).
> hacker (honestly these are my first steps with perl..) but I have enough
> experience with other languages (e.g. tcl which is quite comparable).
libdbus makes itself hard to use, unfortunately...
> > windows process emulation code, so you have to fix the race
> > conditions that ensue somehow (e.g. by not calling urxvt functions
> > from any other "thread" than the urxvt one).
> My plugin now isn't dependant on locks anymore.. yet there is still the
> problem with refreshing. I could set a 1s timer but I'm not to fond of
> polling.
*any* modification of global data you do from another thread (the process
emulation uses C-level-threads to emulate processes, hence the name) is
prone to crashes, unless you lock (which you can't, as urxvt itself would
have to look everywhere and everytime, which it doesn't of course).
you might get away with it because the chances are low, but calling
methods and adding timers etc. will sooner or later crash for program.
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
-=====/_/_//_/\_,_/ /_/\_\
More information about the rxvt-unicode
mailing list