FVWM: Thread Safety Dance

From: Rusty Phillips <rustyp_at_freeshell.org>
Date: Tue, 06 Jul 2004 11:53:31 -0500

Same functions, but thread safe. There's a bug in there somewhere,
though. Sometimes convert doesn't produce an icon, and I can't figure
out why.

The only thing I can come up with is that I'm running out of memory.
Do any of you FvwmPerl guys know how big a hash can be? And what will
happen when it's out of memory?
To give an idea of how much space is needed, 10 windows at 1024x768
resolution in uncompressed raw format take up 22MB. Expect to need more
than that.

DestroyFunc CaptureIcon
AddToFunc CaptureIcon
+ I raise
+ I eval open(TEMP12,"xwd -silent -id $[w.id] |"); \
    local $/; \
    $e{$[w.id]}=<TEMP12>; \
    $f{$[w.id]}=1; \
    close(TEMP12);
    
DestroyFunc UseCaptured
AddToFunc UseCaptured
+ I eval my $pid; $SIG{'CHLD'}='IGNORE'; if(!($pid=fork)) { \
    while (!exists($f{$[w.id]})) {sleep(1); }; \
    open(TEMP12, "|convert -scale $[fvwm_icon_size] -frame 1x1 \
    -mattecolor black -quality 0 xwd:- \
    png:$[HOME]/.fvwm/icon.tmp.$[w.id].png"); }; \
print TEMP12 $e{$[w.id]}; close(TEMP12); \
cmd("WindowId $[w.id] WindowStyle IconOverride, \
     Icon $[HOME]/.fvwm/icon.tmp.$[w.id].png, StaysOnBottom"); \
     delete $e{$[w.id]}; \
     delete $f{$[w.id]}; \
     } else { setpriority 0,$pid,19 }


--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Tue Jul 06 2004 - 11:42:02 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:56 BST