weel 1.99.116 → 1.99.118
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 +28 -16
- data/weel.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5bc42f10a93d8960c022e4b48fe7eaeee25912bb7b9245b2ed4fd20159ed89f
|
4
|
+
data.tar.gz: c55e8d55c288a759a10eee35dfb84d93e414c9e534c8a9c1df47b5ad03a58d3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a67a6c207b00bb5e124391f41b83d6ad98d4c8de3e986c9376e1d78772e9ef157e4c642c5739b0b49daa29c108ebd903e3914a06344e12893bbad55ffedcc82
|
7
|
+
data.tar.gz: ef5ed955f4ce61abe1a4be7924a2faf66a9c296bb11e7cb1fcc3e5b8fce05b0246950bd8fea7f21f4c57c3ccb775928184b74c86b6cde9a4afe4d45cdc034926
|
data/lib/weel.rb
CHANGED
@@ -523,14 +523,12 @@ class WEEL
|
|
523
523
|
cw.join_branches(Thread.current[:branch_traces])
|
524
524
|
|
525
525
|
unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
|
526
|
-
# first set all to no_longer_neccessary
|
526
|
+
# first set all to no_longer_neccessary, just in case, but this should not be necessary
|
527
527
|
Thread.current[:branches].each do |thread|
|
528
|
-
|
529
|
-
|
530
|
-
__weel_recursive_continue(thread)
|
531
|
-
end
|
528
|
+
thread[:nolongernecessary] = true
|
529
|
+
__weel_recursive_continue(thread)
|
532
530
|
end
|
533
|
-
# wait for all
|
531
|
+
# wait for all, they should not even exist at this point
|
534
532
|
Thread.current[:branches].each do |thread|
|
535
533
|
__weel_recursive_join(thread)
|
536
534
|
end
|
@@ -549,7 +547,7 @@ class WEEL
|
|
549
547
|
|
550
548
|
branch_parent[:branches] << Thread.new(*vars) do |*local|
|
551
549
|
Thread.current.abort_on_exception = true
|
552
|
-
Thread.current[:
|
550
|
+
Thread.current[:branch_search] = @__weel_search_positions.any?
|
553
551
|
Thread.current[:branch_parent] = branch_parent
|
554
552
|
Thread.current[:start_event] = Continue.new
|
555
553
|
Thread.current[:local] = local
|
@@ -584,10 +582,20 @@ class WEEL
|
|
584
582
|
__weel_sim_stop(:parallel_branch,connectionwrapper,current_branch_sim_pos) if __weel_sim
|
585
583
|
|
586
584
|
branch_parent[:mutex].synchronize do
|
587
|
-
Thread.current[:branch_status] = true
|
588
585
|
branch_parent[:branch_finished_count] += 1
|
589
586
|
|
590
|
-
if branch_parent[:
|
587
|
+
if branch_parent[:branch_wait_count_cancel_condition] == :last
|
588
|
+
if branch_parent[:branch_finished_count] == branch_parent[:branch_wait_count] && self.__weel_state != :stopping && self.__weel_state != :finishing
|
589
|
+
branch_parent[:branches].each do |thread|
|
590
|
+
if thread.alive? && thread[:branch_wait_count_cancel_active] == false
|
591
|
+
thread[:nolongernecessary] = true
|
592
|
+
__weel_recursive_continue(thread)
|
593
|
+
end
|
594
|
+
end
|
595
|
+
end
|
596
|
+
end
|
597
|
+
|
598
|
+
if branch_parent[:branch_finished_count] == branch_parent[:branches].length && self.__weel_state != :stopping && self.__weel_state != :finishing
|
591
599
|
branch_parent[:branch_event].continue
|
592
600
|
end
|
593
601
|
end
|
@@ -636,7 +644,9 @@ class WEEL
|
|
636
644
|
end
|
637
645
|
Thread.current[:alternative_executed][-1] = true if condition
|
638
646
|
end
|
639
|
-
|
647
|
+
searchmode = __weel_is_in_search_mode
|
648
|
+
__weel_protect_yield(&block) if searchmode || __weel_sim || condition
|
649
|
+
Thread.current[:alternative_executed][-1] = true if __weel_is_in_search_mode != searchmode # we swiched from searchmode true to false, thus branch has been executed which is as good as evaling the condition to true
|
640
650
|
__weel_sim_stop(:alternative,hw,pos,args.merge(:mode => Thread.current[:alternative_mode].last, :condition => ((condition.is_a?(String) || condition.is_a?(Proc)) ? condition : nil))) if __weel_sim
|
641
651
|
end # }}}
|
642
652
|
def otherwise(args={},&block) # {{{
|
@@ -824,9 +834,9 @@ class WEEL
|
|
824
834
|
|
825
835
|
def __weel_activity(position, type, endpoint, parameters, finalize=nil, update=nil, prepare=nil, salvage=nil)# {{{
|
826
836
|
position = __weel_position_test position
|
837
|
+
searchmode = __weel_is_in_search_mode(position)
|
838
|
+
return if searchmode == true
|
827
839
|
begin
|
828
|
-
searchmode = __weel_is_in_search_mode(position)
|
829
|
-
return if searchmode == true
|
830
840
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
831
841
|
|
832
842
|
Thread.current[:continue] = Continue.new
|
@@ -996,7 +1006,7 @@ class WEEL
|
|
996
1006
|
Thread.current[:branch_wait_count_cancel_active] = true
|
997
1007
|
Thread.current[:branch_parent][:branch_wait_count_cancel] += 1
|
998
1008
|
end
|
999
|
-
if Thread.current[:branch_parent][:branch_wait_count_cancel] ==
|
1009
|
+
if Thread.current[:branch_parent][:branch_wait_count_cancel] == Thread.current[:branch_parent][:branch_wait_count] && self.__weel_state != :stopping && self.__weel_state != :finishing
|
1000
1010
|
Thread.current[:branch_parent][:branches].each do |thread|
|
1001
1011
|
if thread.alive? && thread[:branch_wait_count_cancel_active] == false
|
1002
1012
|
thread[:nolongernecessary] = true
|
@@ -1057,9 +1067,10 @@ class WEEL
|
|
1057
1067
|
|
1058
1068
|
def __weel_is_in_search_mode(position = nil)# {{{
|
1059
1069
|
branch = Thread.current
|
1060
|
-
return false if @__weel_search_positions.empty? || branch[:branch_search] == false
|
1061
1070
|
|
1062
|
-
|
1071
|
+
return false unless branch[:branch_search]
|
1072
|
+
|
1073
|
+
if position && branch[:branch_search] && @__weel_search_positions.include?(position) # matching searchpos => start execution from here
|
1063
1074
|
branch[:branch_search] = false # execute all activities in THIS branch (thread) after this point
|
1064
1075
|
branch[:branch_search_now] = true # just now did we switch the search mode
|
1065
1076
|
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
|
@@ -1069,7 +1080,7 @@ class WEEL
|
|
1069
1080
|
end
|
1070
1081
|
@__weel_search_positions[position].detail == :after
|
1071
1082
|
else
|
1072
|
-
|
1083
|
+
true
|
1073
1084
|
end
|
1074
1085
|
end # }}}
|
1075
1086
|
|
@@ -1252,6 +1263,7 @@ public
|
|
1252
1263
|
def start # {{{
|
1253
1264
|
return nil if @dslr.__weel_state != :ready && @dslr.__weel_state != :stopped
|
1254
1265
|
@dslr.__weel_main = Thread.new do
|
1266
|
+
Thread.current[:branch_search] = true if @dslr.__weel_search_positions.any?
|
1255
1267
|
begin
|
1256
1268
|
__weel_control_flow(:running)
|
1257
1269
|
rescue => e
|
data/weel.gemspec
CHANGED