weel 1.99.88 → 1.99.93
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 +30 -12
- 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: 192fe9f77deb35850f74cd72daa68722079328071cfa03ad084deb1150bba042
|
4
|
+
data.tar.gz: 1356643c63307940116767c3f5c9c530b5f8fb1815a6b6e50d643dba2da74bc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 670e85405505882e811166939c1b737e119f22df4df49ca2093475ff66d67404e7ce81f68231fe1b26fe0fedb5f2cdcd6663628ae619f9c721f063df8a0cf22d
|
7
|
+
data.tar.gz: b45751ee1561352c1de7e63fcb5695ad0b11706518b42c483f4f1cd94d51d962b4da9d3985ba8a6970c35d46d827ce7ceab3166af37822f3493b7b717932e33a
|
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
|
@@ -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,8 +681,9 @@ class WEEL
|
|
667
681
|
end
|
668
682
|
end #}}}
|
669
683
|
|
670
|
-
def __weel_progress(
|
684
|
+
def __weel_progress(position, skip=false) #{{{
|
671
685
|
ipc = {}
|
686
|
+
branch = Thread.current
|
672
687
|
if Thread.current[:branch_parent] && Thread.current[:branch_parent][:branch_position]
|
673
688
|
@__weel_positions.delete Thread.current[:branch_parent][:branch_position]
|
674
689
|
ipc[:unmark] ||= []
|
@@ -680,14 +695,21 @@ class WEEL
|
|
680
695
|
ipc[:unmark] ||= []
|
681
696
|
ipc[:unmark] << Thread.current[:branch_position] rescue nil
|
682
697
|
end
|
683
|
-
wp =
|
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)
|
701
|
+
else
|
702
|
+
WEEL::Position.new(position, skip ? :after : :at)
|
703
|
+
end
|
684
704
|
ipc[skip ? :after : :at] = [wp]
|
685
705
|
|
706
|
+
@__weel_search_positions.delete(position)
|
686
707
|
@__weel_search_positions.each do |k,ele| # some may still be in active search but lets unmark them for good measure
|
687
708
|
ipc[:unmark] ||= []
|
688
709
|
ipc[:unmark] << ele
|
689
710
|
true
|
690
711
|
end
|
712
|
+
ipc[:unmark].uniq! if ipc[:unmark]
|
691
713
|
|
692
714
|
@__weel_positions << wp
|
693
715
|
Thread.current[:branch_position] = wp
|
@@ -711,7 +733,7 @@ class WEEL
|
|
711
733
|
return
|
712
734
|
end
|
713
735
|
|
714
|
-
wp = __weel_progress
|
736
|
+
wp = __weel_progress position
|
715
737
|
|
716
738
|
# searchmode position is after, jump directly to vote_sync_after
|
717
739
|
raise Signal::Proceed if searchmode == :after
|
@@ -757,13 +779,7 @@ class WEEL
|
|
757
779
|
raise Signal::Stop unless handlerwrapper.vote_sync_before(params)
|
758
780
|
raise Signal::Skip if self.__weel_state == :stopping || self.__weel_state == :finishing
|
759
781
|
|
760
|
-
|
761
|
-
passthrough = @__weel_search_positions[position].passthrough
|
762
|
-
@__weel_search_positions[position].passthrough = nil
|
763
|
-
else
|
764
|
-
passthrough = nil
|
765
|
-
end
|
766
|
-
handlerwrapper.activity_handle passthrough, params
|
782
|
+
handlerwrapper.activity_handle wp.passthrough, params
|
767
783
|
wp.passthrough = handlerwrapper.activity_passthrough_value
|
768
784
|
unless wp.passthrough.nil?
|
769
785
|
@__weel_handlerwrapper::inform_position_change @__weel_handlerwrapper_args, :wait => [wp]
|
@@ -782,7 +798,7 @@ class WEEL
|
|
782
798
|
if self.__weel_state == :stopping || self.__weel_state == :finishing
|
783
799
|
handlerwrapper.activity_stop
|
784
800
|
wp.passthrough = handlerwrapper.activity_passthrough_value
|
785
|
-
raise Signal::Proceed
|
801
|
+
raise Signal::Proceed if wp.passthrough # if stop, but no passthrough, let manipulate happen and then stop
|
786
802
|
end
|
787
803
|
|
788
804
|
code = if waitingresult == WEEL::Signal::Again
|
@@ -908,9 +924,11 @@ class WEEL
|
|
908
924
|
|
909
925
|
if position && @__weel_search_positions.include?(position) # matching searchpos => start execution from here
|
910
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
|
911
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
|
912
929
|
branch = branch[:branch_parent]
|
913
930
|
branch[:branch_search] = false
|
931
|
+
branch[:branch_search_now] = true # just now did we switch the search mode
|
914
932
|
end
|
915
933
|
@__weel_search_positions[position].detail == :after
|
916
934
|
else
|
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.93
|
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-09-
|
12
|
+
date: 2020-09-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|