weel 1.99.93 → 1.99.98

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/weel.rb +37 -9
  3. data/weel.gemspec +1 -1
  4. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 192fe9f77deb35850f74cd72daa68722079328071cfa03ad084deb1150bba042
4
- data.tar.gz: 1356643c63307940116767c3f5c9c530b5f8fb1815a6b6e50d643dba2da74bc5
3
+ metadata.gz: 9e82bd07a1a46e7456badf0f68f51b61ce8185c4292590e2c3113e3dcef9b23b
4
+ data.tar.gz: a8e5dc3301a874267a5742395816501d778c2b7ccd934590c55e28410c34994e
5
5
  SHA512:
6
- metadata.gz: 670e85405505882e811166939c1b737e119f22df4df49ca2093475ff66d67404e7ce81f68231fe1b26fe0fedb5f2cdcd6663628ae619f9c721f063df8a0cf22d
7
- data.tar.gz: b45751ee1561352c1de7e63fcb5695ad0b11706518b42c483f4f1cd94d51d962b4da9d3985ba8a6970c35d46d827ce7ceab3166af37822f3493b7b717932e33a
6
+ metadata.gz: 8b37432797796439fcff05c476d09f1c3f7ee388f01a83e593c9db8fcb7bc57f413f5809f0a48c31b2ba04f146928ec236a87e6e5e1ca78a487c7eccbfcb82a2
7
+ data.tar.gz: be8e00b7a57362406dfd61d9c84d53ad2451f7219c535c0a2e4562eedd527dba6ca50c32a735e8d898e959eeb6ac9e120ab9e6507f476dfebe9e96cbaa22d60f
data/lib/weel.rb CHANGED
@@ -43,8 +43,7 @@ class WEEL
43
43
 
44
44
  class ReadStructure # {{{
45
45
  def initialize(data,endpoints,additional)
46
- @__weel_data = data.dup
47
- @__weel_data.transform_values! do |v|
46
+ @__weel_data = data.transform_values do |v|
48
47
  if Object.const_defined?(:XML) && XML.const_defined?(:Smart) && v.is_a?(XML::Smart::Dom)
49
48
  v.root.to_doc
50
49
  else
@@ -55,8 +54,7 @@ class WEEL
55
54
  end
56
55
  end
57
56
  end
58
- @__weel_endpoints = endpoints.dup
59
- @__weel_endpoints.transform_values!{ |v| v.dup }
57
+ @__weel_endpoints = endpoints.transform_values{ |v| v.dup }
60
58
  @additional = additional
61
59
  end
62
60
 
@@ -223,6 +221,8 @@ class WEEL
223
221
  else
224
222
  if args.empty? && @__weel_values.key?(name)
225
223
  @__weel_values[name]
224
+ elsif args.empty? && @__weel_values.key?(name.to_s)
225
+ @__weel_values[name.to_s]
226
226
  elsif name.to_s[-1..-1] == "=" && args.length == 1
227
227
  temp = name.to_s[0..-2]
228
228
  @__weel_values[temp.to_sym] = args[0]
@@ -238,7 +238,7 @@ class WEEL
238
238
  end # }}}
239
239
 
240
240
  class HandlerWrapperBase # {{{
241
- def self::loop_guard(lid,count); false; end
241
+ def self::loop_guard(arguments,lid,count); false; end
242
242
  def self::inform_state_change(arguments,newstate); end
243
243
  def self::inform_syntax_error(arguments,err,code); end
244
244
  def self::inform_handlerwrapper_error(arguments,err); end
@@ -275,6 +275,7 @@ class WEEL
275
275
  def simulate(type,nesting,sequence,parent,parameters={}); end
276
276
 
277
277
  def callback(result=nil,options={}); end
278
+ def mem_guard; end
278
279
 
279
280
  def test_condition(mr,code); mr.instance_eval(code); end
280
281
  def manipulate(mr,code,result=nil,options=nil); mr.instance_eval(code); end
@@ -416,7 +417,9 @@ class WEEL
416
417
 
417
418
  __weel_protect_yield(&block)
418
419
 
419
- Thread.current[:branch_wait_count] = (type.is_a?(Hash) && type.size == 1 && type[:wait] != nil && (type[:wait].is_a?(Integer) && type[:wait] > 0) ? type[:wait] : Thread.current[:branches].size)
420
+ Thread.current[:branch_wait_count] = (type.is_a?(Hash) && type[:wait] != nil && (type[:wait].is_a?(Integer) && type[:wait] > 0) ? type[:wait] : Thread.current[:branches].size)
421
+ Thread.current[:branch_wait_count_cancel] = 0
422
+ Thread.current[:branch_wait_count_cancel_condition] = (type.is_a?(Hash) && type[:cancel] != nil && type[:cancel] == :first ) ? :first : :last
420
423
  1.upto Thread.current[:branches].size do
421
424
  Thread.current[:branch_event].wait
422
425
  end
@@ -459,11 +462,12 @@ class WEEL
459
462
  current_branch_sim_pos = branch_parent[:branch_sim_pos]
460
463
  end
461
464
 
462
- Thread.current[:branches] << Thread.new(*vars) do |*local|
465
+ branch_parent[:branches] << Thread.new(*vars) do |*local|
463
466
  Thread.current.abort_on_exception = true
464
467
  Thread.current[:branch_status] = false
465
468
  Thread.current[:branch_parent] = branch_parent
466
469
  Thread.current[:start_event] = Continue.new
470
+ Thread.current[:branch_wait_count_cancel_active] = false
467
471
 
468
472
  if __weel_sim
469
473
  Thread.current[:branch_sim_pos] = @__weel_sim += 1
@@ -767,6 +771,7 @@ class WEEL
767
771
  when :call
768
772
  begin
769
773
  again = catch Signal::Again do
774
+ handlerwrapper.mem_guard
770
775
  rs = ReadStructure.new(@__weel_data,@__weel_endpoints,handlerwrapper.additional)
771
776
  if prepare
772
777
  if prepare.is_a?(Proc)
@@ -869,6 +874,25 @@ class WEEL
869
874
  @__weel_handlerwrapper::inform_handlerwrapper_error @__weel_handlerwrapper_args, err
870
875
  self.__weel_state = :stopping
871
876
  ensure
877
+ handlerwrapper.mem_guard unless handlerwrapper.nil?
878
+ if Thread.current[:branch_parent]
879
+ Thread.current[:branch_parent][:mutex].synchronize do
880
+ if Thread.current[:branch_parent][:branch_wait_count_cancel_condition] == :first
881
+ if !Thread.current[:branch_wait_count_cancel_active]
882
+ Thread.current[:branch_wait_count_cancel_active] = true
883
+ Thread.current[:branch_parent][:branch_wait_count_cancel] += 1
884
+ end
885
+ if Thread.current[:branch_parent][:branch_wait_count_cancel] == Thread.current[:branch_parent][:branch_wait_count] && self.__weel_state != :stopping && self.__weel_state != :finishing
886
+ Thread.current[:branch_parent][:branches].each do |thread|
887
+ if thread.alive? && thread != Thread.current
888
+ thread[:nolongernecessary] = true
889
+ __weel_recursive_continue(thread)
890
+ end
891
+ end
892
+ end
893
+ end
894
+ end
895
+ end
872
896
  Thread.current[:continue].clear if Thread.current[:continue] && Thread.current[:continue].is_a?(Continue)
873
897
  end
874
898
  end # }}}
@@ -1104,8 +1128,12 @@ public
1104
1128
  # Stop the workflow execution
1105
1129
  def stop # {{{
1106
1130
  Thread.new do
1107
- @dslr.__weel_state = :stopping
1108
- @dslr.__weel_main.join if @dslr.__weel_main
1131
+ if @dslr.__weel_state == :running
1132
+ @dslr.__weel_state = :stopping
1133
+ @dslr.__weel_main.join if @dslr.__weel_main
1134
+ elsif @dslr.__weel_state == :ready || @dslr.__weel_state == :stopped
1135
+ @dslr.__weel_state = :stopped
1136
+ end
1109
1137
  end
1110
1138
  end # }}}
1111
1139
  # Start the workflow execution
data/weel.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "weel"
3
- s.version = "1.99.93"
3
+ s.version = "1.99.98"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Workflow Execution Engine Library (WEEL)"
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.99.93
4
+ version: 1.99.98
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
8
8
  - Gerhard Stuermer
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-09-29 00:00:00.000000000 Z
12
+ date: 2021-05-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
@@ -86,7 +86,7 @@ homepage: http://cpee.org/
86
86
  licenses:
87
87
  - LGPL-3.0
88
88
  metadata: {}
89
- post_install_message:
89
+ post_install_message:
90
90
  rdoc_options: []
91
91
  require_paths:
92
92
  - lib
@@ -101,8 +101,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.1.2
105
- signing_key:
104
+ rubygems_version: 3.1.4
105
+ signing_key:
106
106
  specification_version: 4
107
107
  summary: Workflow Execution Engine Library (WEEL)
108
108
  test_files: