Class: Quark::Quark::Concurrent::Context

Inherits:
DatawireQuarkCore::QuarkObject show all
Extended by:
DatawireQuarkCore::Static
Defined in:
lib/quark/concurrent.rb

Overview

The logical stack for async stuff.

Constant Summary

Constants included from DatawireQuarkCore::Static

DatawireQuarkCore::Static::Unassigned

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DatawireQuarkCore::Static

_lazy_statics, static, unlazy_statics

Methods inherited from DatawireQuarkCore::QuarkObject

#to_s

Constructor Details

#initialize(parent) ⇒ Context

Returns a new instance of Context.



1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
# File 'lib/quark/concurrent.rb', line 1136

def initialize(parent)
    
    self.__init_fields__
    (self)._parent = parent
    if ((parent) == (nil))
        (self)._runtime = ::Quark.quark.spi.RuntimeFactory.factory.makeRuntime()
        (self).collector = ::Quark.quark.concurrent.Collector.new()
    else
        (self)._runtime = (parent)._runtime
        (self).collector = (parent).collector
    end

    nil
end

Instance Attribute Details

#_parentObject

Returns the value of attribute _parent.



1127
1128
1129
# File 'lib/quark/concurrent.rb', line 1127

def _parent
  @_parent
end

#_runtimeObject

Returns the value of attribute _runtime.



1127
1128
1129
# File 'lib/quark/concurrent.rb', line 1127

def _runtime
  @_runtime
end

#collectorObject

Returns the value of attribute collector.



1127
1128
1129
# File 'lib/quark/concurrent.rb', line 1127

def collector
  @collector
end

Class Method Details

.currentObject



1154
1155
1156
1157
1158
1159
# File 'lib/quark/concurrent.rb', line 1154

def self.current()
    
    return ::Quark.quark.concurrent.Context._current.getValue()

    nil
end

.globalObject



1161
1162
1163
1164
1165
1166
1167
1168
1169
# File 'lib/quark/concurrent.rb', line 1161

def self.global()
    
    if ((::Quark.quark.concurrent.Context._global) == (nil))
        ::Quark.quark.concurrent.Context._global = ::Quark.quark.concurrent.Context.new(nil)
    end
    return ::Quark.quark.concurrent.Context._global

    nil
end

.runtimeObject



1171
1172
1173
1174
1175
1176
# File 'lib/quark/concurrent.rb', line 1171

def self.runtime()
    
    return (::Quark.quark.concurrent.Context.current())._runtime

    nil
end

.swap(c) ⇒ Object



1178
1179
1180
1181
1182
1183
# File 'lib/quark/concurrent.rb', line 1178

def self.swap(c)
    
    ::Quark.quark.concurrent.Context._current.setValue(c)

    nil
end

Instance Method Details

#__init_fields__Object



1235
1236
1237
1238
1239
1240
1241
1242
# File 'lib/quark/concurrent.rb', line 1235

def __init_fields__()
    
    self._parent = nil
    self._runtime = nil
    self.collector = nil

    nil
end

#_getClassObject



1185
1186
1187
1188
1189
1190
# File 'lib/quark/concurrent.rb', line 1185

def _getClass()
    
    return "quark.concurrent.Context"

    nil
end

#_getField(name) ⇒ Object



1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
# File 'lib/quark/concurrent.rb', line 1192

def _getField(name)
    
    if ((name) == ("_global"))
        return ::Quark.quark.concurrent.Context._global
    end
    if ((name) == ("_current"))
        return ::Quark.quark.concurrent.Context._current
    end
    if ((name) == ("_parent"))
        return (self)._parent
    end
    if ((name) == ("_runtime"))
        return (self)._runtime
    end
    if ((name) == ("collector"))
        return (self).collector
    end
    return nil

    nil
end

#_setField(name, value) ⇒ Object



1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
# File 'lib/quark/concurrent.rb', line 1214

def _setField(name, value)
    
    if ((name) == ("_global"))
        ::Quark.quark.concurrent.Context._global = ::DatawireQuarkCore.cast(value) { ::Quark.quark.concurrent.Context }
    end
    if ((name) == ("_current"))
        ::Quark.quark.concurrent.Context._current = ::DatawireQuarkCore.cast(value) { ::DatawireQuarkCore::TLS }
    end
    if ((name) == ("_parent"))
        (self)._parent = ::DatawireQuarkCore.cast(value) { ::Quark.quark.concurrent.Context }
    end
    if ((name) == ("_runtime"))
        (self)._runtime = ::DatawireQuarkCore.cast(value) { ::Quark.quark.Runtime }
    end
    if ((name) == ("collector"))
        (self).collector = ::DatawireQuarkCore.cast(value) { ::Quark.quark.concurrent.Collector }
    end

    nil
end