text:
import type { counterStateType } from '../reducers/counter';

type actionType = {
  +type: string
};

export const SET_100_COUNTER = 'SET_100_COUNTER';
export const INCREMENT_COUNTER = 'INCREMENT_COUNTER';
export const DECREMENT_COUNTER = 'DECREMENT_COUNTER';

export function set100() {
  return {
    type: SET_100_COUNTER,
  };
}

export function increment() {
  return {
    type: INCREMENT_COUNTER
  };
}

export function decrement() {
  return {
    type: DECREMENT_COUNTER
  };
}

export function incrementIfOdd() {
  return (dispatch: (action: actionType) => void, getState: () => counterStateType) => {
    const { counter } = getState();

    if (counter % 2 === 0) {
      return;
    }

    dispatch(increment());
  };
}

export function incrementAsync(delay: number = 1000) {
  return (dispatch: (action: actionType) => void) => {
    setTimeout(() => {
      dispatch(increment());
    }, delay);
  };
}


text:
require 'chefspec'
require 'chefspec/berkshelf'
require_relative 'support/matchers'

RSpec.configure do |config|
  config.platform = 'ubuntu'
  config.version  = '12.04'
end

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitReportReporter -->
<testsuite hostname="retina.dellroad.org" name="org.jsimpledb.CounterTest" tests="1" failures="0" timestamp="17 Apr 2015 01:30:29 GMT" time="0.008" errors="0">
  <testcase name="testCounter" time="0.008" classname="org.jsimpledb.CounterTest"/>
</testsuite> <!-- org.jsimpledb.CounterTest -->


text:
<?php

/**
 * Service definition for Urlshortener (v1).
 *
 *

 * Lets you create, inspect, and manage goo.gl short URLs

 *
 *

 * For more information about this service, see the API
 * Documentation
 *

 *
 * @author Google, Inc.
 */
class Google_Service_Urlshortener extends Google_Service
{
  /** Manage your goo.gl short URLs. */
  const URLSHORTENER =
      "https://www.googleapis.com/auth/urlshortener";

  public $url;

  /**
   * Constructs the internal representation of the Urlshortener service.
   *
   * @param Google_Client $client
   */
  public function __construct(Google_Client $client)
  {
    parent::__construct($client);
    $this->rootUrl = 'https://www.googleapis.com/';
    $this->servicePath = 'urlshortener/v1/';
    $this->version = 'v1';
    $this->serviceName = 'urlshortener';

    $this->url = new Google_Service_Urlshortener_Resource_Url(
        $this,
        $this->serviceName,
        'url',
        array(
          'methods' => array(
            'get' => array(
              'path' => 'url',
              'httpMethod' => 'GET',
              'parameters' => array(
                'shortUrl' => array(
                  'location' => 'query',
                  'type' => 'string',
                  'required' => true,
                ),
                'projection' => array(
                  'location' => 'query',
                  'type' => 'string',
                ),
              ),
            ),'insert' => array(
              'path' => 'url',
              'httpMethod' => 'POST',
              'parameters' => array(),
            ),'list' => array(
              'path' => 'url/history',
              'httpMethod' => 'GET',
              'parameters' => array(
                'projection' => array(
                  'location' => 'query',
                  'type' => 'string',
                ),
                'start-token' => array(
                  'location' => 'query',
                  'type' => 'string',
                ),
              ),
            ),
          )
        )
    );
  }
}


text:
"""Command line tool for joystick AIO node."""

import sys

import gflags
from makani.avionics.common import aio
from makani.avionics.common import pack_avionics_messages
from makani.lib.python import c_helpers
from makani.system import labels

switch_position_helper = c_helpers.EnumHelper('JoystickSwitchPositionLabel',
                                              labels,
                                              prefix='kJoystickSwitchPosition')

AXES = ['roll', 'pitch', 'yaw', 'throttle']
SWITCHES = ['tri', 'momentary']

# Values determined empirically.
_AXIS_CALIBRATION_THRESHOLD = 0xf000  # [counts]
_SWITCH_CALIBRATION_THRESHOLD = 0x14000  # [counts]

gflags.DEFINE_bool('sample', False,
                   'Output a single sample from the joystick.')
gflags.DEFINE_bool('sample_raw', False,
                   'Output a single raw sample from the joystick.')
gflags.DEFINE_bool('dump', False,
                   'Continuously output samples from the joystick.')
gflags.DEFINE_bool('dump_raw', False,
                   'Continuously output raw samples from the joystick.')
gflags.DEFINE_bool('calibrate', False,
                   'Run calibration procedure.')

FLAGS = gflags.FLAGS

def _IsPositiveAxis(axis):
  return axis == 'throttle'

def _EnableRawSamples(aio_client):
  message = pack_avionics_messages.JoystickCommandMessage()
  message.enable_raw = True
  aio_client.Send(message, 'kMessageTypeJoystickCommand', 'kAioNodeControllerA')

def _DisableRawSamples(aio_client):
  message = pack_avionics_messages.JoystickCommandMessage()
  message.enable_raw = False
  aio_client.Send(message, 'kMessageTypeJoystickCommand', 'kAioNodeControllerA')

def _GetRawSample(aio_client):
  try:
    (_, _, msg) = aio_client.Recv()
    return msg.channel

  except KeyboardInterrupt:
    _DisableRawSamples(aio_client)
    aio_client.Close()
    sys.exit()

def _CalibrateAxis(aio_client):
  axis_data = [{'min': 0xffffffff, 'max': 0x0000000} for _ in xrange(7)]
  _EnableRawSamples(aio_client)
  while True:
    raw_data = _GetRawSample(aio_client)
    for chan in xrange(7):
      value = raw_data[chan]

      if axis_data[chan]['max'] < value:
        axis_data[chan]['max'] = value
      if axis_data[chan]['min'] > value:
        axis_data[chan]['min'] = value

      diff = axis_data[chan]['max'] - axis_data[chan]['min']
      center = axis_data[chan]['min'] + diff / 2

      # Calibration finished when the range of values is above
      # _AXIS_CALIBRATION_THRESHOLD and the joystick returns to near center.
      if (diff > _AXIS_CALIBRATION_THRESHOLD
          and abs(center - value) < _AXIS_CALIBRATION_THRESHOLD / 8):
        _DisableRawSamples(aio_client)
        return (chan, axis_data[chan])

def _CalibrateSwitch(aio_client):
  axis_data = [{'min': 0xffffffff, 'max': 0x0000000} for _ in xrange(7)]
  _EnableRawSamples(aio_client)
  while True:
    raw_data = _GetRawSample(aio_client)
    for chan in xrange(7):
      value = raw_data[chan]

      if axis_data[chan]['max'] < value:
        axis_data[chan]['max'] = value
      if axis_data[chan]['min'] > value:
        axis_data[chan]['min'] = value

      diff = axis_data[chan]['max'] - axis_data[chan]['min']

      # Calibration finished when the range of values is above
      # _SWITCH_CALIBRATION_THRESHOLD and the switch returns to its
      # down position.
      if (diff > _SWITCH_CALIBRATION_THRESHOLD
          and value - axis_data[chan]['min'] < 0x100):
        _DisableRawSamples(aio_client)
        return (chan, axis_data[chan])

def _DecodeSwitch(switch):
  if switch == switch_position_helper.Value('Up'):
    return 'up'
  elif switch == switch_position_helper.Value('Middle'):
    return 'mid'
  elif switch == switch_position_helper.Value('Down'):
    return 'down'
  else:
    return 'unknown'

def _DecodeArmed(value):
  if value == pack_avionics_messages.kJoystickArmed:
    return 'armed'
  else:
    return 'disarmed'

def _PrintSample(aio_client):
  try:
    (_, _, msg) = aio_client.Recv()
    print('roll: %f, pitch: %f, yaw: %f, throttle: %f' %
          (msg.roll, msg.pitch, msg.yaw, msg.throttle))
    print('tri_switch: %s, momentary_switch: %s, armed_switch: %s' %
          (_DecodeSwitch(msg.tri_switch),
           _DecodeSwitch(msg.momentary_switch),
           _DecodeArmed(msg.armed_switch)))

  except KeyboardInterrupt:
    aio_client.Close()
    sys.exit()

def _PrintRawSample(aio_client):
  try:
    (_, _, msg) = aio_client.Recv()

    for chan in xrange(7):
      sys.stdout.write('%d: %08x  ' % (chan, msg.channel[chan]))
    sys.stdout.write('\n')

  except KeyboardInterrupt:
    _DisableRawSamples(aio_client)
    aio_client.Close()
    sys.exit()

def _Sample():
  aio_client = aio.AioClient(['kMessageTypeJoystickStatus'])
  _PrintSample(aio_client)

def _SampleRaw():
  aio_client = aio.AioClient(['kMessageTypeJoystickRawStatus',
                              'kMessageTypeJoystickCommand'])
  _EnableRawSamples(aio_client)
  _PrintRawSample(aio_client)
  _DisableRawSamples(aio_client)

def _Dump():
  aio_client = aio.AioClient(['kMessageTypeJoystickStatus'])
  while True:
    _PrintSample(aio_client)

def _DumpRaw():
  aio_client = aio.AioClient(['kMessageTypeJoystickRawStatus',
                              'kMessageTypeJoystickCommand'])
  _EnableRawSamples(aio_client)
  while True:
    _PrintRawSample(aio_client)

def _GenerateAxisCalibration(cal):
  string = """\
    '{name}.index': {index:d},
    '{name}.offset': {offset:e},
    '{name}.gain': {gain:e},
    '{name}.min': {min:f},
    '{name}.max': {max:f},
""".format(**cal)
  return string

def _GenerateSwitchCalibration(cal):
  string = """\
    '{name}_switch.index': {index:d},
    '{name}_switch.min': 0x{min:08X},
    '{name}_switch.max': 0x{max:08X},
""".format(**cal)
  return string

def _Calibrate():
  """Run the calibration procedure.

  This functions walks the operator through each of the axes,
  finding their limits and zeros.
  """

  aio_client = aio.AioClient(['kMessageTypeJoystickRawStatus',
                              'kMessageTypeJoystickCommand'])
  axis_data = {}
  _ = raw_input('Center all axes and press enter.')
  for axis in AXES:
    print 'Move %s axis through its limits.' % (axis)
    axis_data[axis] = _CalibrateAxis(aio_client)

  _ = raw_input('Move axes to their zero points and press enter.')
  _EnableRawSamples(aio_client)
  zero_points = _GetRawSample(aio_client)
  _DisableRawSamples(aio_client)

  switch_data = {}
  _ = raw_input('Make sure all switches are in their down state '
                'and press enter.')
  for switch in SWITCHES:
    print 'Move %s switch to its up state and back down.' % (switch)
    switch_data[switch] = _CalibrateSwitch(aio_client)

  print '# Joystick calibration parameters.'
  print 'joystick_calib_params = {'
  for axis in AXES:
    index = axis_data[axis][0]
    min_value = axis_data[axis][1]['min']
    max_value = axis_data[axis][1]['max']
    offset = -zero_points[index]

    # TODO: Deal with axis sign calibration.  Some axes are inverted
    #                (i.e. top is negative and bottom is positive.)
    gain = 1.0 / (max_value - min_value)
    if _IsPositiveAxis(axis):
      axis_min = 0.0
      axis_max = 1.0
    else:
      gain *= 2.0
      axis_min = -1.0
      axis_max = 1.0

    cal = _GenerateAxisCalibration({
        'name': axis,
        'index': index,
        'offset': offset,
        'gain': gain,
        'min': axis_min,
        'max': axis_max,
    })
    print cal,

  for switch in SWITCHES:
    index = switch_data[switch][0]
    min_value = switch_data[switch][1]['min']
    max_value = switch_data[switch][1]['max']

    cal = _GenerateSwitchCalibration({
        'name': switch,
        'index': index,
        'min': min_value,
        'max': max_value,
    })
    print cal,

  print '}'

def main(argv):
  try:
    argv = FLAGS(argv)
  except gflags.FlagsError, e:
    print '{}\nUsage: {} ARGS\n{}'.format(e, sys.argv[0], FLAGS)
    sys.exit(1)

  action_taken = False

  if FLAGS.sample:
    _Sample()
    action_taken = True

  if FLAGS.sample_raw:
    _SampleRaw()
    action_taken = True

  if FLAGS.dump:
    _Dump()
    action_taken = True

  if FLAGS.dump_raw:
    _DumpRaw()
    action_taken = True

  if FLAGS.calibrate:
    _Calibrate()
    action_taken = True

  if not action_taken:
    print('No action specified.\n'
          'Usage: {} ARGS\n{}'.format(sys.argv[0], FLAGS))
    sys.exit(1)

if __name__ == '__main__':
  main(sys.argv)


text:
package multistore

import (
	"context"

	"github.com/influxdata/influxdb/v2/chronograf"
)

// Ensure SourcesStore implements chronograf.SourcesStore.
var _ chronograf.SourcesStore = &SourcesStore{}

// SourcesStore delegates to the SourcesStores that compose it
type SourcesStore struct {
	Stores []chronograf.SourcesStore
}

// All concatenates the Sources of all contained Stores
func (multi *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) {
	all := []chronograf.Source{}
	sourceSet := map[int]struct{}{}

	ok := false
	var err error
	for _, store := range multi.Stores {
		var sources []chronograf.Source
		sources, err = store.All(ctx)
		if err != nil {
			// If this Store is unable to return an array of sources, skip to the
			// next Store.
			continue
		}
		ok = true // We've received a response from at least one Store
		for _, s := range sources {
			// Enforce that the source has a unique ID
			// If the source has been seen before, don't override what we already have
			if _, okay := sourceSet[s.ID]; !okay { // We have a new Source!
				sourceSet[s.ID] = struct{}{} // We just care that the ID is unique
				all = append(all, s)
			}
		}
	}
	if !ok {
		return nil, err
	}
	return all, nil
}

// Add the src to the first Store to respond successfully
func (multi *SourcesStore) Add(ctx context.Context, src chronograf.Source) (chronograf.Source, error) {
	var err error
	for _, store := range multi.Stores {
		var s chronograf.Source
		s, err = store.Add(ctx, src)
		if err == nil {
			return s, nil
		}
	}
	return chronograf.Source{}, nil
}

// Delete delegates to all stores, returns success if one Store is successful
func (multi *SourcesStore) Delete(ctx context.Context, src chronograf.Source) error {
	var err error
	for _, store := range multi.Stores {
		err = store.Delete(ctx, src)
		if err == nil {
			return nil
		}
	}
	return err
}

// Get finds the Source by id among all contained Stores
func (multi *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error) {
	var err error
	for _, store := range multi.Stores {
		var s chronograf.Source
		s, err = store.Get(ctx, id)
		if err == nil {
			return s, nil
		}
	}
	return chronograf.Source{}, err
}

// Update the first store to return a successful response
func (multi *SourcesStore) Update(ctx context.Context, src chronograf.Source) error {
	var err error
	for _, store := range multi.Stores {
		err = store.Update(ctx, src)
		if err == nil {
			return nil
		}
	}
	return err
}


text:
package com.dangdang.ddframe.rdb.sharding.id.generator.self;

import org.junit.Before;
import org.junit.Rule;
import org.junit.contrib.java.lang.system.EnvironmentVariables;

public class SystemEnvWorkerIdTest extends AbstractWorkerIdTest {

    @Rule
    public final EnvironmentVariables environmentVariables = new EnvironmentVariables();

    @Before
    public void setup() {
        environmentVariables.set("SJDBC_SELF_ID_GENERATOR_WORKER_ID", "13");
        super.setup();
    }

    @Override
    protected long getWorkerId() {
        return 13L;
    }
}


text:
class BluetoothChooserController;

// Represents a Bluetooth chooser to ask the user to select a Bluetooth
// device from a list of options. This implementation is for desktop.
// BluetoothChooserAndroid implements the mobile part.
class BluetoothChooserDesktop : public content::BluetoothChooser {
 public:
  explicit BluetoothChooserDesktop(
      BluetoothChooserController* bluetooth_chooser_controller);
  ~BluetoothChooserDesktop() override;

  // BluetoothChooser:
  void SetAdapterPresence(AdapterPresence presence) override;
  void ShowDiscoveryState(DiscoveryState state) override;
  void AddOrUpdateDevice(const std::string& device_id,
                         bool should_update_name,
                         const base::string16& device_name,
                         bool is_gatt_connected,
                         bool is_paired,
                         int signal_strength_level) override;
  void RemoveDevice(const std::string& device_id) override;

 private:
  // Weak. DeviceChooserContentView[Cocoa] owns it.
  BluetoothChooserController* bluetooth_chooser_controller_;

  DISALLOW_COPY_AND_ASSIGN(BluetoothChooserDesktop);
};

#endif  // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_DESKTOP_H_


text:
namespace llvm {

typedef int PathID;
typedef SmallVector<PathID, 2> PathList;
typedef std::vector<BasicBlock *> Path;

// Structure to manage path information, which we do in order to
// provide small unique path identifiers.
class PathCache {
public:
  void clear() { entries_.clear(); cache_.clear(); }
  PathList findAllSimplePaths(BasicBlock *src, BasicBlock *dst,
                              bool allowSelfCycle = true);
  typedef SmallPtrSet<BasicBlock *, 8> SkipSet;
  PathList findAllSimplePaths(SkipSet *grey, BasicBlock *src, BasicBlock *dst,
                              bool allowSelfCycle = true);

  // this isn't really path related but...  We calculate SCCs as a map
  // from blocks to a "canonical" element of the SCC. This can be
  // turned into a map from blocks to SCC sets in linear time but
  // since we only need to check if blocks are in the same SCC we
  // don't need to.
  typedef DenseMap<BasicBlock *, BasicBlock *> SCCMap;
  SCCMap findSCCs(SkipSet *skip, Function *func);
  SCCMap findSCCs(BasicBlock *bindSite, Function *func);
  SCCMap *findSCCsCached(BasicBlock *bindSite, Function *func);
  SkipSet pathSCCs(BasicBlock *bindSite, PathID pathid);

  Path extractPath(PathID k) const;

  static const PathID kEmptyPath = -1;
  typedef std::pair<BasicBlock *, PathID> PathCacheKey;
  typedef std::pair<PathCacheKey, BasicBlock *> PathCacheEntry;

  bool isEmpty(PathID k) const { return k == kEmptyPath; }

  PathCacheEntry const &getEntry(PathID k) const { return entries_[k]; }
  PathCacheKey const &getKey(PathID k) const { return getEntry(k).first; }
  BasicBlock *getHead(PathID k) const { return getKey(k).first; }
  PathID getTail(PathID k) const { return getKey(k).second; }
  BasicBlock *getLast(PathID k) { return getEntry(k).second; }

  // For debugging:
  std::string formatPath(PathID pathid) const;
  void dumpPaths(const PathList &paths) const;

private:
  std::vector<PathCacheEntry> entries_;
  DenseMap<PathCacheKey, PathID> cache_;
  DenseMap<BasicBlock *, SCCMap> sccCache_;

  PathID addToPath(BasicBlock *b, PathID id);
};

}

#endif


text:
#pragma once

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

// ESP32S3 does not have DPORT bus, so these macros are all same as the non-DPORT versions

#define DPORT_INTERRUPT_DISABLE()
#define DPORT_INTERRUPT_RESTORE()

/**
 * @brief Read a sequence of DPORT registers to the buffer.
 *
 * @param[out] buff_out  Contains the read data.
 * @param[in]  address   Initial address for reading registers.
 * @param[in]  num_words The number of words.
 */
void esp_dport_access_read_buffer(uint32_t *buff_out, uint32_t address, uint32_t num_words);

// _DPORT_REG_WRITE & DPORT_REG_WRITE are equivalent.
#define _DPORT_REG_READ(_r)        (*(volatile uint32_t *)(_r))
#define _DPORT_REG_WRITE(_r, _v)   (*(volatile uint32_t *)(_r)) = (_v)

// Write value to DPORT register (does not require protecting)
#define DPORT_REG_WRITE(_r, _v)   _DPORT_REG_WRITE((_r), (_v))

#define DPORT_REG_READ(_r)    _DPORT_REG_READ(_r)
#define DPORT_SEQUENCE_REG_READ(_r)    _DPORT_REG_READ(_r)

//get bit or get bits from register
#define DPORT_REG_GET_BIT(_r, _b)  (DPORT_REG_READ(_r) & (_b))

//set bit or set bits to register
#define DPORT_REG_SET_BIT(_r, _b)  DPORT_REG_WRITE((_r), (DPORT_REG_READ(_r)|(_b)))

//clear bit or clear bits of register
#define DPORT_REG_CLR_BIT(_r, _b)  DPORT_REG_WRITE((_r), (DPORT_REG_READ(_r) & (~(_b))))

//set bits of register controlled by mask
#define DPORT_REG_SET_BITS(_r, _b, _m) DPORT_REG_WRITE((_r), ((DPORT_REG_READ(_r) & (~(_m))) | ((_b) & (_m))))

//get field from register, uses field _S & _V to determine mask
#define DPORT_REG_GET_FIELD(_r, _f) ((DPORT_REG_READ(_r) >> (_f##_S)) & (_f##_V))

//set field to register, used when _f is not left shifted by _f##_S
#define DPORT_REG_SET_FIELD(_r, _f, _v) DPORT_REG_WRITE((_r), ((DPORT_REG_READ(_r) & (~((_f##_V) << (_f##_S))))|(((_v) & (_f##_V))<<(_f##_S))))

//get field value from a variable, used when _f is not left shifted by _f##_S
#define DPORT_VALUE_GET_FIELD(_r, _f) (((_r) >> (_f##_S)) & (_f))

//get field value from a variable, used when _f is left shifted by _f##_S
#define DPORT_VALUE_GET_FIELD2(_r, _f) (((_r) & (_f))>> (_f##_S))

//set field value to a variable, used when _f is not left shifted by _f##_S
#define DPORT_VALUE_SET_FIELD(_r, _f, _v) ((_r)=(((_r) & ~((_f) << (_f##_S)))|((_v)<<(_f##_S))))

//set field value to a variable, used when _f is left shifted by _f##_S
#define DPORT_VALUE_SET_FIELD2(_r, _f, _v) ((_r)=(((_r) & ~(_f))|((_v)<<(_f##_S))))

//generate a value from a field value, used when _f is not left shifted by _f##_S
#define DPORT_FIELD_TO_VALUE(_f, _v) (((_v)&(_f))<<_f##_S)

//generate a value from a field value, used when _f is left shifted by _f##_S
#define DPORT_FIELD_TO_VALUE2(_f, _v) (((_v)<<_f##_S) & (_f))

//Register read macros with an underscore prefix access DPORT memory directly. In IDF apps, use the non-underscore versions to be SMP-safe.
#define _DPORT_READ_PERI_REG(addr) (*((volatile uint32_t *)(addr)))
#define _DPORT_WRITE_PERI_REG(addr, val) (*((volatile uint32_t *)(addr))) = (uint32_t)(val)
#define _DPORT_REG_SET_BIT(_r, _b)  _DPORT_REG_WRITE((_r), (_DPORT_REG_READ(_r)|(_b)))
#define _DPORT_REG_CLR_BIT(_r, _b)  _DPORT_REG_WRITE((_r), (_DPORT_REG_READ(_r) & (~(_b))))

#define DPORT_READ_PERI_REG(addr)       _DPORT_READ_PERI_REG(addr)

//write value to register
#define DPORT_WRITE_PERI_REG(addr, val) _DPORT_WRITE_PERI_REG((addr), (val))

//clear bits of register controlled by mask
#define DPORT_CLEAR_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)&(~(mask))))

//set bits of register controlled by mask
#define DPORT_SET_PERI_REG_MASK(reg, mask)   DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)|(mask)))

//get bits of register controlled by mask
#define DPORT_GET_PERI_REG_MASK(reg, mask)   (DPORT_READ_PERI_REG(reg) & (mask))

//get bits of register controlled by highest bit and lowest bit
#define DPORT_GET_PERI_REG_BITS(reg, hipos,lowpos)     ((DPORT_READ_PERI_REG(reg)>>(lowpos))&((1<<((hipos)-(lowpos)+1))-1))

//set bits of register controlled by mask and shift
#define DPORT_SET_PERI_REG_BITS(reg,bit_map,value,shift) DPORT_WRITE_PERI_REG((reg), ((DPORT_READ_PERI_REG(reg)&(~((bit_map)<<(shift))))|(((value) & bit_map)<<(shift))))

//get field of register
#define DPORT_GET_PERI_REG_BITS2(reg, mask,shift)      ((DPORT_READ_PERI_REG(reg)>>(shift))&(mask))
//}}

#ifdef __cplusplus
}
#endif


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Notifications — Bambu Comments 2.0.1 documentation</title>

    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <link rel="top" title="Bambu Comments 2.0.1 documentation" href="index.html" />
    <link rel="next" title="Template tags" href="tags.html" />
    <link rel="prev" title="Haystack" href="haystack.html" />

Navigation

          index

          modules |

          next |

          previous |

Bambu Comments 2.0.1 documentation »

Notifications¶

Notifications are provided via Bambu Notifications.

<tt class="docutils literal">comment_posted</tt>

This notification fires when a comment is posted on an object

Previous topic

Haystack

Next topic

Template tags

This Page

Show Source

Quick search

    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          index

          modules |

          next |

          previous |

Bambu Comments 2.0.1 documentation »

        © Copyright 2014, Steadman.
      Created using Sphinx 1.2.2.


text:
using IX.StandardExtensions.Contracts;

namespace IX.StandardExtensions.Threading;

/// <summary>
/// A base class for a reader/writer synchronized class.
/// </summary>
/// <seealso cref="IX.StandardExtensions.ComponentModel.DisposableBase" />
public abstract partial class ReaderWriterSynchronizedBase
{
    /// <summary>
    /// Invokes using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    protected void ReadLock<TParam1>(Action<TParam1> action, TParam1 param1)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            localAction(param1);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn ReadLock<TParam1, TReturn>(Func<TParam1, TReturn> action, TParam1 param1)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            return localAction(param1);
        }
    }

    /// <summary>
    /// Invokes using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    protected void WriteLock<TParam1>(Action<TParam1> action, TParam1 param1)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            localAction(param1);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn WriteLock<TParam1, TReturn>(Func<TParam1, TReturn> action, TParam1 param1)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            return localAction(param1);
        }
    }

    /// <summary>
    /// Invokes using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    protected void ReadLock<TParam1, TParam2>(Action<TParam1, TParam2> action, TParam1 param1, TParam2 param2)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            localAction(param1, param2);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn ReadLock<TParam1, TParam2, TReturn>(Func<TParam1, TParam2, TReturn> action, TParam1 param1, TParam2 param2)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            return localAction(param1, param2);
        }
    }

    /// <summary>
    /// Invokes using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    protected void WriteLock<TParam1, TParam2>(Action<TParam1, TParam2> action, TParam1 param1, TParam2 param2)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            localAction(param1, param2);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn WriteLock<TParam1, TParam2, TReturn>(Func<TParam1, TParam2, TReturn> action, TParam1 param1, TParam2 param2)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            return localAction(param1, param2);
        }
    }

    /// <summary>
    /// Invokes using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    protected void ReadLock<TParam1, TParam2, TParam3>(Action<TParam1, TParam2, TParam3> action, TParam1 param1, TParam2 param2, TParam3 param3)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            localAction(param1, param2, param3);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn ReadLock<TParam1, TParam2, TParam3, TReturn>(Func<TParam1, TParam2, TParam3, TReturn> action, TParam1 param1, TParam2 param2, TParam3 param3)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            return localAction(param1, param2, param3);
        }
    }

    /// <summary>
    /// Invokes using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    protected void WriteLock<TParam1, TParam2, TParam3>(Action<TParam1, TParam2, TParam3> action, TParam1 param1, TParam2 param2, TParam3 param3)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            localAction(param1, param2, param3);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn WriteLock<TParam1, TParam2, TParam3, TReturn>(Func<TParam1, TParam2, TParam3, TReturn> action, TParam1 param1, TParam2 param2, TParam3 param3)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            return localAction(param1, param2, param3);
        }
    }

    /// <summary>
    /// Invokes using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    protected void ReadLock<TParam1, TParam2, TParam3, TParam4>(Action<TParam1, TParam2, TParam3, TParam4> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            localAction(param1, param2, param3, param4);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn ReadLock<TParam1, TParam2, TParam3, TParam4, TReturn>(Func<TParam1, TParam2, TParam3, TParam4, TReturn> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            return localAction(param1, param2, param3, param4);
        }
    }

    /// <summary>
    /// Invokes using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    protected void WriteLock<TParam1, TParam2, TParam3, TParam4>(Action<TParam1, TParam2, TParam3, TParam4> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            localAction(param1, param2, param3, param4);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn WriteLock<TParam1, TParam2, TParam3, TParam4, TReturn>(Func<TParam1, TParam2, TParam3, TParam4, TReturn> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            return localAction(param1, param2, param3, param4);
        }
    }

    /// <summary>
    /// Invokes using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    protected void ReadLock<TParam1, TParam2, TParam3, TParam4, TParam5>(Action<TParam1, TParam2, TParam3, TParam4, TParam5> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            localAction(param1, param2, param3, param4, param5);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn ReadLock<TParam1, TParam2, TParam3, TParam4, TParam5, TReturn>(Func<TParam1, TParam2, TParam3, TParam4, TParam5, TReturn> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            return localAction(param1, param2, param3, param4, param5);
        }
    }

    /// <summary>
    /// Invokes using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    protected void WriteLock<TParam1, TParam2, TParam3, TParam4, TParam5>(Action<TParam1, TParam2, TParam3, TParam4, TParam5> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            localAction(param1, param2, param3, param4, param5);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn WriteLock<TParam1, TParam2, TParam3, TParam4, TParam5, TReturn>(Func<TParam1, TParam2, TParam3, TParam4, TParam5, TReturn> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            return localAction(param1, param2, param3, param4, param5);
        }
    }

    /// <summary>
    /// Invokes using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TParam6">The type of parameter to be passed to the invoked method at index 5.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <param name="param6">A parameter of type <typeparamref name="TParam6" /> to pass to the invoked method at index 5.</param>
    protected void ReadLock<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(Action<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            localAction(param1, param2, param3, param4, param5, param6);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TParam6">The type of parameter to be passed to the invoked method at index 5.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <param name="param6">A parameter of type <typeparamref name="TParam6" /> to pass to the invoked method at index 5.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn ReadLock<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn>(Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            return localAction(param1, param2, param3, param4, param5, param6);
        }
    }

    /// <summary>
    /// Invokes using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TParam6">The type of parameter to be passed to the invoked method at index 5.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <param name="param6">A parameter of type <typeparamref name="TParam6" /> to pass to the invoked method at index 5.</param>
    protected void WriteLock<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(Action<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            localAction(param1, param2, param3, param4, param5, param6);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TParam6">The type of parameter to be passed to the invoked method at index 5.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <param name="param6">A parameter of type <typeparamref name="TParam6" /> to pass to the invoked method at index 5.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn WriteLock<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn>(Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TReturn> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            return localAction(param1, param2, param3, param4, param5, param6);
        }
    }

    /// <summary>
    /// Invokes using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TParam6">The type of parameter to be passed to the invoked method at index 5.</typeparam>
    /// <typeparam name="TParam7">The type of parameter to be passed to the invoked method at index 6.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <param name="param6">A parameter of type <typeparamref name="TParam6" /> to pass to the invoked method at index 5.</param>
    /// <param name="param7">A parameter of type <typeparamref name="TParam7" /> to pass to the invoked method at index 6.</param>
    protected void ReadLock<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7>(Action<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6, TParam7 param7)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            localAction(param1, param2, param3, param4, param5, param6, param7);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TParam6">The type of parameter to be passed to the invoked method at index 5.</typeparam>
    /// <typeparam name="TParam7">The type of parameter to be passed to the invoked method at index 6.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <param name="param6">A parameter of type <typeparamref name="TParam6" /> to pass to the invoked method at index 5.</param>
    /// <param name="param7">A parameter of type <typeparamref name="TParam7" /> to pass to the invoked method at index 6.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn ReadLock<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn>(Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6, TParam7 param7)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            return localAction(param1, param2, param3, param4, param5, param6, param7);
        }
    }

    /// <summary>
    /// Invokes using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TParam6">The type of parameter to be passed to the invoked method at index 5.</typeparam>
    /// <typeparam name="TParam7">The type of parameter to be passed to the invoked method at index 6.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <param name="param6">A parameter of type <typeparamref name="TParam6" /> to pass to the invoked method at index 5.</param>
    /// <param name="param7">A parameter of type <typeparamref name="TParam7" /> to pass to the invoked method at index 6.</param>
    protected void WriteLock<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7>(Action<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6, TParam7 param7)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            localAction(param1, param2, param3, param4, param5, param6, param7);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TParam6">The type of parameter to be passed to the invoked method at index 5.</typeparam>
    /// <typeparam name="TParam7">The type of parameter to be passed to the invoked method at index 6.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <param name="param6">A parameter of type <typeparamref name="TParam6" /> to pass to the invoked method at index 5.</param>
    /// <param name="param7">A parameter of type <typeparamref name="TParam7" /> to pass to the invoked method at index 6.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn WriteLock<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn>(Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TReturn> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6, TParam7 param7)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            return localAction(param1, param2, param3, param4, param5, param6, param7);
        }
    }

    /// <summary>
    /// Invokes using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TParam6">The type of parameter to be passed to the invoked method at index 5.</typeparam>
    /// <typeparam name="TParam7">The type of parameter to be passed to the invoked method at index 6.</typeparam>
    /// <typeparam name="TParam8">The type of parameter to be passed to the invoked method at index 7.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <param name="param6">A parameter of type <typeparamref name="TParam6" /> to pass to the invoked method at index 5.</param>
    /// <param name="param7">A parameter of type <typeparamref name="TParam7" /> to pass to the invoked method at index 6.</param>
    /// <param name="param8">A parameter of type <typeparamref name="TParam8" /> to pass to the invoked method at index 7.</param>
    protected void ReadLock<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8>(Action<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6, TParam7 param7, TParam8 param8)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            localAction(param1, param2, param3, param4, param5, param6, param7, param8);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a reader lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TParam6">The type of parameter to be passed to the invoked method at index 5.</typeparam>
    /// <typeparam name="TParam7">The type of parameter to be passed to the invoked method at index 6.</typeparam>
    /// <typeparam name="TParam8">The type of parameter to be passed to the invoked method at index 7.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <param name="param6">A parameter of type <typeparamref name="TParam6" /> to pass to the invoked method at index 5.</param>
    /// <param name="param7">A parameter of type <typeparamref name="TParam7" /> to pass to the invoked method at index 6.</param>
    /// <param name="param8">A parameter of type <typeparamref name="TParam8" /> to pass to the invoked method at index 7.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn ReadLock<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn>(Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6, TParam7 param7, TParam8 param8)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerRead(_locker))
        {
            return localAction(param1, param2, param3, param4, param5, param6, param7, param8);
        }
    }

    /// <summary>
    /// Invokes using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TParam6">The type of parameter to be passed to the invoked method at index 5.</typeparam>
    /// <typeparam name="TParam7">The type of parameter to be passed to the invoked method at index 6.</typeparam>
    /// <typeparam name="TParam8">The type of parameter to be passed to the invoked method at index 7.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <param name="param6">A parameter of type <typeparamref name="TParam6" /> to pass to the invoked method at index 5.</param>
    /// <param name="param7">A parameter of type <typeparamref name="TParam7" /> to pass to the invoked method at index 6.</param>
    /// <param name="param8">A parameter of type <typeparamref name="TParam8" /> to pass to the invoked method at index 7.</param>
    protected void WriteLock<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8>(Action<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6, TParam7 param7, TParam8 param8)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            localAction(param1, param2, param3, param4, param5, param6, param7, param8);
        }
    }

    /// <summary>
    /// Gets a result from an invoker using a writer lock.
    /// </summary>
    /// <typeparam name="TParam1">The type of parameter to be passed to the invoked method at index 0.</typeparam>
    /// <typeparam name="TParam2">The type of parameter to be passed to the invoked method at index 1.</typeparam>
    /// <typeparam name="TParam3">The type of parameter to be passed to the invoked method at index 2.</typeparam>
    /// <typeparam name="TParam4">The type of parameter to be passed to the invoked method at index 3.</typeparam>
    /// <typeparam name="TParam5">The type of parameter to be passed to the invoked method at index 4.</typeparam>
    /// <typeparam name="TParam6">The type of parameter to be passed to the invoked method at index 5.</typeparam>
    /// <typeparam name="TParam7">The type of parameter to be passed to the invoked method at index 6.</typeparam>
    /// <typeparam name="TParam8">The type of parameter to be passed to the invoked method at index 7.</typeparam>
    /// <typeparam name="TReturn">The return type of the invoked method.</typeparam>
    /// <param name="action">The action.</param>
    /// <param name="param1">A parameter of type <typeparamref name="TParam1" /> to pass to the invoked method at index 0.</param>
    /// <param name="param2">A parameter of type <typeparamref name="TParam2" /> to pass to the invoked method at index 1.</param>
    /// <param name="param3">A parameter of type <typeparamref name="TParam3" /> to pass to the invoked method at index 2.</param>
    /// <param name="param4">A parameter of type <typeparamref name="TParam4" /> to pass to the invoked method at index 3.</param>
    /// <param name="param5">A parameter of type <typeparamref name="TParam5" /> to pass to the invoked method at index 4.</param>
    /// <param name="param6">A parameter of type <typeparamref name="TParam6" /> to pass to the invoked method at index 5.</param>
    /// <param name="param7">A parameter of type <typeparamref name="TParam7" /> to pass to the invoked method at index 6.</param>
    /// <param name="param8">A parameter of type <typeparamref name="TParam8" /> to pass to the invoked method at index 7.</param>
    /// <returns>A disposable object representing the lock.</returns>
    protected TReturn WriteLock<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn>(Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TReturn> action, TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6, TParam7 param7, TParam8 param8)
    {
        ThrowIfCurrentObjectDisposed();
        var localAction = Requires.NotNull(action);

        using (new ValueSynchronizationLockerWrite(_locker))
        {
            return localAction(param1, param2, param3, param4, param5, param6, param7, param8);
        }
    }
}


text:
'use strict';

//dts
import {IHandleError, IOnceHookObj, ITestSuite} from "suman-types/dts/test-suite";
import {IGlobalSumanObj, ISumanAllHookDomain, ISumanDomain} from "suman-types/dts/global";
import {ISuman, Suman} from "../suman";

//polyfills
const process = require('suman-browser-polyfills/modules/process');
const global = require('suman-browser-polyfills/modules/global');

//core
import domain = require('domain');
import assert = require('assert');
import util = require('util');

//npm
import * as su from 'suman-utils';
import chalk from 'chalk';

//project
const _suman: IGlobalSumanObj = global.__suman = (global.__suman || {});
import {makeAllHookCallback} from './make-fini-callbacks';
import * as helpers from './handle-promise-generator';
import {constants} from '../config/suman-constants';
import {cloneError} from '../helpers/general';
// import {makeHookParam} from './t-proto-hook';
import {AllHookParam} from "../test-suite-params/all-hook/all-hook-param";
import {freezeExistingProps} from 'freeze-existing-props';

/////////////////////////////////////////////////////////////////////////////////////

export const makeHandleBeforesAndAfters = function (suman: ISuman, gracefulExit: Function) {

  // don't use arrow function here, b/c we may need to access arguments for retry action
  return function handleBeforesAndAfters(self: ITestSuite, aBeforeOrAfter: IOnceHookObj, cb: Function, retryData?: any) {

    if (_suman.uncaughtExceptionTriggered) {
      _suman.log.error(
        `runtime error => "UncaughtException already occurred" => halting program in file:\n[${__filename}]`
      );
      return;
    }

    // records whether a hook was actually attempted
    // IMPORTANT: this should appear after the _suman.uncaughtExceptionTriggered check
    // because an after.always hook needs to run even in the presence of an uncaught exception
    aBeforeOrAfter.alreadyInitiated = true;

    // const onTimeout = function () {
    //   fini(cloneError(aBeforeOrAfter.warningErr, constants.warnings.HOOK_TIMED_OUT_ERROR), true);
    // };

    const timerObj = {
      timer: null as any
      // timer: setTimeout(onTimeout, _suman.weAreDebugging ? 5000000 : aBeforeOrAfter.timeout)
    };

    const assertCount = {
      num: 0
    };

    const d = domain.create() as ISumanAllHookDomain;
    d.sumanAllHook = true;
    d.sumanAllHookName = aBeforeOrAfter.desc || '(unknown all-hook name)';

    const fini = makeAllHookCallback(d, assertCount, aBeforeOrAfter, timerObj, gracefulExit, cb);
    const fnStr = aBeforeOrAfter.fn.toString();

    if (suman.config.retriesEnabled === true && Number.isInteger(aBeforeOrAfter.retries)) {
      fini.retryFn = retryData ? retryData.retryFn : handleBeforesAndAfters.bind(null, ...Array.from(arguments));
    }

    let dError = false;

    const handleError: IHandleError = (err: any) => {

      if (aBeforeOrAfter.dynamicallySkipped === true) {
        return fini(null);
      }

      if (fini.retryFn) {
        if (!retryData) {
          return fini.retryFn({retryFn: fini.retryFn, retryCount: 1, maxRetries: aBeforeOrAfter.retries});
        }
        else if (retryData.retryCount < aBeforeOrAfter.retries) {
          retryData.retryCount++;
          return fini.retryFn(retryData);
        }
        else {
          _suman.log.error('maximum retries attempted.');
        }
      }

      const errMessage = err && (err.stack || err.message || util.inspect(err));
      err = cloneError(aBeforeOrAfter.warningErr, errMessage, false);

      const stk = err.stack || err;
      const formatedStk = typeof stk === 'string' ? stk : util.inspect(stk);
      // const formatedStk = String(stck).split('\n').map(item => '\t' + item).join('\n');

      if (!dError) {
        dError = true;
        clearTimeout(timerObj.timer);
        if (aBeforeOrAfter.fatal === false) {
          _suman.writeTestError(' => Suman non-fatal error => Normally fatal error in hook, but "fatal" option for the hook ' +
            'is set to false => \n' + formatedStk);
          fini(null);
        }
        else {
          //errors are always fatal in all hooks, unless fatal is explicitly set to false
          gracefulExit({
            sumanFatal: true,
            sumanExitCode: constants.EXIT_CODES.FATAL_HOOK_ERROR,
            stack: 'Fatal error in hook => (to continue even in the event of an error ' +
            'in a hook use option {fatal:false}) => ' + '\n' + formatedStk
          });
        }
      }
      else {
        // error handler called more than once, after first call, all we do is simply log the error
        _suman.writeTestError(' => Suman error => Error in hook => \n' + formatedStk);
      }
    };

    d.on('error', handleError);

    process.nextTick(() => {

      const {sumanOpts} = _suman;

      if (sumanOpts.debug_hooks) {
        _suman.log.info(`now running all hook with name '${chalk.yellow(aBeforeOrAfter.desc)}'.`);
      }

      // need to d.run instead process.nextTick
      // so that errors thrown in same-tick get trapped by "Node.js domains in browser"
      // process.nextTick is necessary in the first place, so that async module does not experience Zalgo

      d.run(function runAllHook() {

        _suman.activeDomain = d;
        let warn = false;

        if (fnStr.indexOf('Promise') > 0 || fnStr.indexOf('async') === 0) {
          warn = true;
        }

        const h = new AllHookParam(aBeforeOrAfter, assertCount, handleError, fini, timerObj);
        h.__shared = self.shared;
        h.supply = self.supply;
        h.block = self;
        h.desc = aBeforeOrAfter.desc;
        fini.thot = h;

        if (su.isGeneratorFn(aBeforeOrAfter.fn)) {
          const handle = helpers.handleReturnVal(h.handlePossibleError.bind(h), fnStr, aBeforeOrAfter);
          handle(helpers.handleGenerator(aBeforeOrAfter.fn, h));
        }
        else if (aBeforeOrAfter.cb) {

          h.callbackMode = true;

          // TODO: in the future, we may be able to check for presence of callback, if no callback, then fire error
          // if (!su.checkForValInStr(fnStr, /done/g)) {
          //    throw aBeforeOrAfter.NO_DONE;
          // }

          const dne = (err?: any) => {
            h.handlePossibleError(err);
          };

          h.done = dne;
          h.ctn = h.pass = function (ignoredError?: any) {
            fini(null);
          };

          let arg = Object.setPrototypeOf(dne, h);

          if (aBeforeOrAfter.fn.call(null, arg)) {  //check to see if we have a defined return value
            _suman.writeTestError(
              cloneError(aBeforeOrAfter.warningErr, constants.warnings.RETURNED_VAL_DESPITE_CALLBACK_MODE, true).stack
            );
          }
        }
        else {
          const handle = helpers.handleReturnVal(h.handlePossibleError.bind(h), fnStr, aBeforeOrAfter);
          handle(aBeforeOrAfter.fn.call(null, h), warn);
        }
      });

    });
  }
};


text:
const Vector = require('../../lib/Vector')
const TensorMath = require('../../lib/TensorMath')
const PointIntention = require('../../Intention/PointIntention')
const LookAtIntention = require('../../Intention/LookAtIntention')
const LineIntention = require('../../Intention/LineIntention')

const RulePlays = require('./RulePlays')

const BASE_SPEED = 65

let robot_saw_the_ball_multiplier = 1.3

module.exports = class AttackerConduct extends RulePlays {
    setup(){
        super.setup()
        let ball = () => {

            return {
                x: this.frame.cleanData.ball.x,
                y: this.frame.cleanData.ball.y
            }
        }

        let ballToGoalNormal = () => {
            let b = this.frame.cleanData.ball
            let c = {x: 680, y: 0}

            let ballToGoal = Vector.sub(b, c)

            // Vector normal
            ballToGoal = Vector.norm({x: ballToGoal.x, y: -ballToGoal.y})

            return Vector.angle(ballToGoal)
        }

        this.addIntetion(new PointIntention('KeepOnBall', {
            target: ball,
            radius: 110,
            decay: TensorMath.new.finish,
            multiplier: BASE_SPEED
        }))

        this.addIntetion(new LineIntention('ConductBall', {
            target: ball,
            theta: ballToGoalNormal,
            lineSize: 75,
            lineSizeMax: 75,
            lineDist: 100,
            decay: TensorMath.new.finish,
            multiplier: BASE_SPEED * robot_saw_the_ball_multiplier
        }))

        // Impedir bater na parede
        this.avoidFieldWalls1 = new LineIntention('avoidFieldWalls', {
            target: {x:0, y: 610},
            theta: Vector.direction("left"),
            lineSize: 1700,
            lineDist: 30,
            lineDistMax: 30,
            decay: TensorMath.new.sum(1).mult(-1).finish,
            multiplier: BASE_SPEED * 2
        })

        this.addIntetion(this.avoidFieldWalls1)

        // Impedir bater na parede
        this.avoidFieldWalls2 = new LineIntention('avoidFieldWalls', {
            target: {x:0, y: -610},
            theta: Vector.direction("left"),
            lineSize: 1700,
            lineDist: 30,
            lineDistMax: 30,
            decay: TensorMath.new.sum(1).mult(-1).finish,
            multiplier: BASE_SPEED * 2
        })
        this.addIntetion(this.avoidFieldWalls2)

        this.lookToBall = new LookAtIntention('look_to_ball', {
            target: ball,
            decay: TensorMath.new.pow(1/2).finish,
            multiplier: 640
        })
        this.addIntetion(this.lookToBall)
      }
      loop(){
    }

}


text:
package com.webcohesion.enunciate.examples.jaxwsrijersey.genealogy.data;

import java.util.List;

/**
 * @author Ryan Heaton
 */
public class EventDescriptionContainer {

  private List<Event> typesToDescriptions;

  public List<Event> getTypesToDescriptions() {
    return typesToDescriptions;
  }

  public void setTypesToDescriptions(List<Event> typesToDescriptions) {
    this.typesToDescriptions = typesToDescriptions;
  }
}


text:
var bomdata = require('./bomdata.json');
var convertAddressToLatitudeLongitude = require('./convertAddressToLatitudeLongitude');

function buildLocationObject(location, siteNumber, state, callback) {
    data = {};
    var locationString = location + " " + state + ", Australia";
    var RunGeoLocate = false;
    var locationIsSet = bomdata[state] && bomdata[state][location];
    if (locationIsSet && typeof bomdata[state][location].lat === 'string') {
        RunGeoLocate = true;
    } else if (!locationIsSet) {
        RunGeoLocate = true;
    }
    if (RunGeoLocate === true) { // if the latitude is not set in the file, try again to find it

        convertAddressToLatitudeLongitude(locationString, function(error, lat, lng) {
            if (error) {
                console.log("error:", error);
                return;
            }
            data = {
                siteNumber: siteNumber,
                lat: lat,
                lng: lng
            };
            callback(null, data);
        });

    } else { // else read the value from
        data = {
            siteNumber: siteNumber,
            lat: bomdata[state][location].lat,
            lng: bomdata[state][location].lng
        };
        callback(null, data);
    }
}

module.exports = buildLocationObject;


text:
#include "CCObject.h"
#include "CCAutoreleasePool.h"
#include "ccMacros.h"
#include "script_support/CCScriptSupport.h"

NS_CC_BEGIN

CCObject* CCCopying::copyWithZone(CCZone *pZone)
{
    CC_UNUSED_PARAM(pZone);
    CCAssert(0, "not implement");
    return 0;
}

CCObject::CCObject(void)
{
    static unsigned int uObjectCount = 0;

    m_uID = ++uObjectCount;
    m_nLuaID = 0;

    // when the object is created, the refrence count of it is 1
    m_uReference = 1;
    m_bManaged = false;
}

CCObject::~CCObject(void)
{
    // if the object is managed, we should remove it
    // from pool manager
    if (m_bManaged)
    {
        CCPoolManager::sharedPoolManager()->removeObject(this);
    }

    // if the object is referenced by Lua engine, remove it
    if (m_nLuaID)
    {
        CCScriptEngineManager::sharedManager()->getScriptEngine()->removeCCObjectByID(m_nLuaID);
    }
}

CCObject* CCObject::copy()
{
    return copyWithZone(0);
}

void CCObject::release(void)
{
    CCAssert(m_uReference > 0, "reference count should greater than 0");
    --m_uReference;

    if (m_uReference == 0)
    {
        delete this;
    }
}

void CCObject::retain(void)
{
    CCAssert(m_uReference > 0, "reference count should greater than 0");

    ++m_uReference;
}

CCObject* CCObject::autorelease(void)
{
    CCPoolManager::sharedPoolManager()->addObject(this);

    m_bManaged = true;
    return this;
}

bool CCObject::isSingleReference(void)
{
    return m_uReference == 1;
}

unsigned int CCObject::retainCount(void)
{
    return m_uReference;
}

bool CCObject::isEqual(const CCObject *pObject)
{
    return this == pObject;
}

NS_CC_END


text:
'use strict';

var build = require('dchambers-lib-build-tool');

build.bundleDeps(
	build.bundle('typester.js', ['./lib/global-typester.js']),
	build.bundle('typester-spec-tests.js', ['./spec/test/tests.spec.js']),
	build.bundle('typester-performance-test.js', ['./scripts/test-performance.js'])
);


text:
<?php

$config = Config::singleton();

$config->set('url', 'localhost');
$config->set('dbhost', 'localhost');
$config->set('dbname', 'inmobiliariaDB');
$config->set('dbuser', 'root');
$config->set('dbpass', '1');
$config->set('debug', TRUE);
$config->set('mailFrom',"algo@gmail.com");
$config->set('passMailFrom',"pass");

?>