[PD] save state. race condition?

Miller Puckette msp at ucsd.edu
Fri Oct 12 17:58:32 CEST 2018


One thing that's potentially troublesome is combining savestate and loadbang
(and loadbang-like behavior built into GUIs as well.)  The savestate
output arrives before any loadbangs.  So there's extra work to do if
you want an object to initialize itself but also to use savestate.  Here's
an example:

#N canvas 29 70 469 394 16;
#X floatatom 103 123 7 0 0 1 high - -;
#X obj 24 313 outlet~;
#X obj 103 5 loadbang;
#X obj 24 48 inlet~;
#X floatatom 103 146 7 0 0 1 low - -;
#X msg 103 67 1;
#X obj 25 275 clip~;
#X obj 375 209 f;
#X obj 375 238 pack;
#X obj 288 145 savestate;
#X obj 288 249 unpack;
#X obj 103 34 spigot 1;
#X msg 194 34 0;
#X connect 0 0 6 2;
#X connect 0 0 7 1;
#X connect 2 0 11 0;
#X connect 3 0 6 0;
#X connect 4 0 6 1;
#X connect 4 0 8 1;
#X connect 5 0 0 0;
#X connect 6 0 1 0;
#X connect 7 0 8 0;
#X connect 8 0 9 0;
#X connect 9 0 10 0;
#X connect 9 0 12 0;
#X connect 9 1 7 0;
#X connect 10 0 0 0;
#X connect 10 1 4 0;
#X connect 11 0 5 0;
#X connect 12 0 11 1;
#X coords 0 -1 1 1 130 70 1 100 100;

I badly need to update the documentation with better examples of how to use
feaures like this...

cheers
Miller

On Fri, Oct 12, 2018 at 04:56:39PM +0200, Atte via Pd-list wrote:
> Hi
> 
> I just simply flat out love the new savestate mechanism!
> 
> I normally start from the example in the help, add sends/receives, I use it alot with number boxes and toggles.
> 
> I found that in larger patches, sometimes the states doesn't always "get to" all receives, the gui elements seems to always work, but if I use a restored value, I need to add a [pipe 0.0001] after the [r $0-somevalue] and where I want to use it.
> 
> I tried comming up with a simple example that shows this behavious, but it needs a patch of a certain complexity, so I'll have to continue on the bug-example.
> 
> Anyone one else been bitten by this? Any tips on avoiding it?
> 
> If it matters I'm on linux, pd version "0.49.0-2~bpo9+1" from debian backports...
> 
> Cheers
> -- 
> Atte
> 
> http://atte.dk   http://a773.dk
> 
> 
> 
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list





More information about the Pd-list mailing list