weel 1.99.85 → 1.99.92
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/weel.rb +49 -29
- data/weel.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 382652394caca0a926ca5dd00d5c9582042d8ca33bddbcc339e0db3132e6814b
|
4
|
+
data.tar.gz: 1f3b40aef98c19c0da0bc65fbd8019e730f25ad9628c9d0b75fdcb84a3f92660
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd87fada9619e4c8816851df18d61c560e10f608944c8fdaf4cc69d4afa4fb549a647143865052dac70f7bd1ff3b8744d1168c57cec1b14995826442de177f11
|
7
|
+
data.tar.gz: a992e55a9561d6003a60812e022cedfed1b9ebb21c549a19758d45c99ce95931b515914f401d4f9c104d9aff158e4e49c856b4f522b676e0b626aba9d15d577f
|
data/lib/weel.rb
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
# <http://www.gnu.org/licenses/>.
|
16
16
|
|
17
17
|
require 'thread'
|
18
|
+
require 'securerandom'
|
18
19
|
|
19
20
|
class WEEL
|
20
21
|
def initialize(*args)# {{{
|
@@ -237,6 +238,7 @@ class WEEL
|
|
237
238
|
end # }}}
|
238
239
|
|
239
240
|
class HandlerWrapperBase # {{{
|
241
|
+
def self::loop_guard(lid,count); false; end
|
240
242
|
def self::inform_state_change(arguments,newstate); end
|
241
243
|
def self::inform_syntax_error(arguments,err,code); end
|
242
244
|
def self::inform_handlerwrapper_error(arguments,err); end
|
@@ -288,7 +290,7 @@ class WEEL
|
|
288
290
|
end
|
289
291
|
def as_json(*)
|
290
292
|
jsn = { 'position' => @position }
|
291
|
-
jsn['
|
293
|
+
jsn['passthrough'] = @passthrough if @passthrough
|
292
294
|
jsn
|
293
295
|
end
|
294
296
|
def to_s
|
@@ -297,6 +299,12 @@ class WEEL
|
|
297
299
|
def to_json(*args)
|
298
300
|
as_json.to_json(*args)
|
299
301
|
end
|
302
|
+
def eql?(other)
|
303
|
+
to_s == other.to_s
|
304
|
+
end
|
305
|
+
def hash
|
306
|
+
to_s.hash
|
307
|
+
end
|
300
308
|
end # }}}
|
301
309
|
|
302
310
|
class Continue # {{{
|
@@ -584,15 +592,21 @@ class WEEL
|
|
584
592
|
__weel_sim_stop(:loop,hw,pos,args.merge(:testing=>condition[1],:condition=>cond))
|
585
593
|
return
|
586
594
|
end
|
595
|
+
loop_guard = 0
|
596
|
+
loop_id = SecureRandom.uuid
|
587
597
|
catch :escape do
|
588
598
|
case condition[1]
|
589
599
|
when :pre_test
|
590
600
|
while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing
|
601
|
+
loop_guard += 1
|
591
602
|
__weel_protect_yield(&block)
|
603
|
+
sleep 1 if @__weel_handlerwrapper::loop_guard(@__weel_handlerwrapper_args,loop_id,loop_guard)
|
592
604
|
end
|
593
605
|
when :post_test
|
594
606
|
begin
|
607
|
+
loop_guard += 1
|
595
608
|
__weel_protect_yield(&block)
|
609
|
+
sleep 1 if @__weel_handlerwrapper::loop_guard(@__weel_handlerwrapper_args,loop_id,loop_guard)
|
596
610
|
end while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing
|
597
611
|
end
|
598
612
|
end
|
@@ -622,7 +636,7 @@ class WEEL
|
|
622
636
|
searchmode = __weel_is_in_search_mode(position)
|
623
637
|
return if searchmode
|
624
638
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
625
|
-
__weel_progress
|
639
|
+
__weel_progress position, true
|
626
640
|
self.__weel_state = :stopping
|
627
641
|
end #}}}
|
628
642
|
|
@@ -667,26 +681,36 @@ class WEEL
|
|
667
681
|
end
|
668
682
|
end #}}}
|
669
683
|
|
670
|
-
def __weel_progress(
|
684
|
+
def __weel_progress(position, skip=false) #{{{
|
671
685
|
ipc = {}
|
672
|
-
|
673
|
-
|
674
|
-
|
686
|
+
branch = Thread.current
|
687
|
+
if Thread.current[:branch_parent] && Thread.current[:branch_parent][:branch_position]
|
688
|
+
@__weel_positions.delete Thread.current[:branch_parent][:branch_position]
|
689
|
+
ipc[:unmark] ||= []
|
690
|
+
ipc[:unmark] << Thread.current[:branch_parent][:branch_position] rescue nil
|
691
|
+
Thread.current[:branch_parent][:branch_position] = nil
|
692
|
+
end
|
693
|
+
if Thread.current[:branch_position]
|
694
|
+
@__weel_positions.delete Thread.current[:branch_position]
|
695
|
+
ipc[:unmark] ||= []
|
696
|
+
ipc[:unmark] << Thread.current[:branch_position] rescue nil
|
697
|
+
end
|
698
|
+
wp = if branch[:branch_search_now] == true
|
699
|
+
branch[:branch_search_now] = false
|
700
|
+
WEEL::Position.new(position, skip ? :after : :at, @__weel_search_positions[position].passthrough)
|
675
701
|
else
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
ipc[:unmark] << Thread.current[:branch_position] rescue nil
|
686
|
-
end
|
687
|
-
wp = WEEL::Position.new(position, skip ? :after : :at, nil)
|
688
|
-
ipc[skip ? :after : :at] = [wp]
|
702
|
+
WEEL::Position.new(position, skip ? :after : :at)
|
703
|
+
end
|
704
|
+
ipc[skip ? :after : :at] = [wp]
|
705
|
+
|
706
|
+
@__weel_search_positions.delete(position)
|
707
|
+
@__weel_search_positions.each do |k,ele| # some may still be in active search but lets unmark them for good measure
|
708
|
+
ipc[:unmark] ||= []
|
709
|
+
ipc[:unmark] << ele
|
710
|
+
true
|
689
711
|
end
|
712
|
+
ipc[:unmark].uniq! if ipc[:unmark]
|
713
|
+
|
690
714
|
@__weel_positions << wp
|
691
715
|
Thread.current[:branch_position] = wp
|
692
716
|
|
@@ -709,7 +733,7 @@ class WEEL
|
|
709
733
|
return
|
710
734
|
end
|
711
735
|
|
712
|
-
wp = __weel_progress
|
736
|
+
wp = __weel_progress position
|
713
737
|
|
714
738
|
# searchmode position is after, jump directly to vote_sync_after
|
715
739
|
raise Signal::Proceed if searchmode == :after
|
@@ -755,13 +779,7 @@ class WEEL
|
|
755
779
|
raise Signal::Stop unless handlerwrapper.vote_sync_before(params)
|
756
780
|
raise Signal::Skip if self.__weel_state == :stopping || self.__weel_state == :finishing
|
757
781
|
|
758
|
-
|
759
|
-
passthrough = @__weel_search_positions[position].passthrough
|
760
|
-
@__weel_search_positions[position].passthrough = nil
|
761
|
-
else
|
762
|
-
passthrough = nil
|
763
|
-
end
|
764
|
-
handlerwrapper.activity_handle passthrough, params
|
782
|
+
handlerwrapper.activity_handle wp.passthrough, params
|
765
783
|
wp.passthrough = handlerwrapper.activity_passthrough_value
|
766
784
|
unless wp.passthrough.nil?
|
767
785
|
@__weel_handlerwrapper::inform_position_change @__weel_handlerwrapper_args, :wait => [wp]
|
@@ -780,7 +798,7 @@ class WEEL
|
|
780
798
|
if self.__weel_state == :stopping || self.__weel_state == :finishing
|
781
799
|
handlerwrapper.activity_stop
|
782
800
|
wp.passthrough = handlerwrapper.activity_passthrough_value
|
783
|
-
raise Signal::Proceed
|
801
|
+
raise Signal::Proceed if wp.passthrough # if stop, but no passthrough, let manipulate happen and then stop
|
784
802
|
end
|
785
803
|
|
786
804
|
code = if waitingresult == WEEL::Signal::Again
|
@@ -906,11 +924,13 @@ class WEEL
|
|
906
924
|
|
907
925
|
if position && @__weel_search_positions.include?(position) # matching searchpos => start execution from here
|
908
926
|
branch[:branch_search] = false # execute all activities in THIS branch (thread) after this point
|
927
|
+
branch[:branch_search_now] = true # just now did we switch the search mode
|
909
928
|
while branch.key?(:branch_parent) # also all parent branches should execute activities after this point, additional branches spawned by parent branches should still be in search mode
|
910
929
|
branch = branch[:branch_parent]
|
911
930
|
branch[:branch_search] = false
|
931
|
+
branch[:branch_search_now] = true # just now did we switch the search mode
|
912
932
|
end
|
913
|
-
@__weel_search_positions[position].detail == :after
|
933
|
+
@__weel_search_positions[position].detail == :after
|
914
934
|
else
|
915
935
|
branch[:branch_search] = true
|
916
936
|
end
|
data/weel.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.99.
|
4
|
+
version: 1.99.92
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-09-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|