text:
/* ----------------------------------------------------------------- */
/*           The Toolkit for Building Voice Interaction Systems      */
/*           "MMDAgent" developed by MMDAgent Project Team           */
/*           http://www.mmdagent.jp/                                 */
/* ----------------------------------------------------------------- */
/*                                                                   */
/*  Copyright (c) 2009-2012  Nagoya Institute of Technology          */
/*                           Department of Computer Science          */
/*                                                                   */
/* All rights reserved.                                              */
/*                                                                   */
/* Redistribution and use in source and binary forms, with or        */
/* without modification, are permitted provided that the following   */
/* conditions are met:                                               */
/*                                                                   */
/* - Redistributions of source code must retain the above copyright  */
/*   notice, this list of conditions and the following disclaimer.   */
/* - Redistributions in binary form must reproduce the above         */
/*   copyright notice, this list of conditions and the following     */
/*   disclaimer in the documentation and/or other materials provided */
/*   with the distribution.                                          */
/* - Neither the name of the MMDAgent project team nor the names of  */
/*   its contributors may be used to endorse or promote products     */
/*   derived from this software without specific prior written       */
/*   permission.                                                     */
/*                                                                   */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND            */
/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,       */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF          */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE          */
/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS */
/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          */
/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED   */
/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     */
/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,   */
/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY    */
/* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE           */
/* POSSIBILITY OF SUCH DAMAGE.                                       */
/* ----------------------------------------------------------------- */

/* headers */

#include "MMDFiles.h"

/* PMDModel::resetBone: reset bones */
void PMDModel::resetBone()
{
   unsigned short i;
   btVector3 zeroPos = btVector3(0.0f, 0.0f, 0.0f);
   btQuaternion zeroRot = btQuaternion(0.0f, 0.0f, 0.0f, 1.0f);

   /* set zero position for IK-controlled bones before applying motion */
   for (i = 0; i < m_numBone; i++)
      switch(m_boneList[i].getType()) {
      case UNDER_IK:
      case IK_TARGET:
         m_boneList[i].setCurrentPosition(&zeroPos);
         m_boneList[i].setCurrentRotation(&zeroRot);
         break;
      }
}

/* PMDModel::updateBone: update bones */
void PMDModel::updateBone()
{
   unsigned short i;

   /* update bone matrix from current position and rotation */
   for (i = 0; i < m_numBone; i++)
      m_orderedBoneList[i]->update();

   /* solve IK chains */
   if (m_enableSimulation) {
      /* IK with simulated bones can be skipped */
      for (i = 0; i < m_numIK; i++)
         if (!m_IKSimulated[i]) m_IKList[i].solve();
   } else {
      /* all IK should be solved when simulation is off */
      for (i = 0; i < m_numIK; i++)
         m_IKList[i].solve();
   }

   /* apply under-rotate effects */
   for (i = 0; i < m_numRotateBone; i++)
      m_boneList[m_rotateBoneIDList[i]].update();
}

/* PMDModel::updateBoneFromSimulation: update bone transform from rigid body */
void PMDModel::updateBoneFromSimulation()
{
   unsigned long i;

   for (i = 0; i < m_numRigidBody; i++)
      m_rigidBodyList[i].applyTransformToBone();
}

/* PMDModel::updateFace: update face morph from current face weights */
void PMDModel::updateFace()
{
   unsigned short i;

   if (m_faceList) {
      m_baseFace->apply(m_vertexList);
      for (i = 0; i < m_numFace; i++)
         if (m_faceList[i].getWeight() > PMDMODEL_MINFACEWEIGHT)
            m_faceList[i].add(m_vertexList, m_faceList[i].getWeight());
   }
}

/* PMDModel::updateSkin: update skin data from bone orientation */
void PMDModel::updateSkin()
{
   unsigned short i;
   unsigned long j;
   btVector3 v, v2, n, n2;

   /* calculate transform matrix for skinning (global -> local) */
   for (i = 0; i < m_numBone; i++)
      m_boneList[i].calcSkinningTrans(&(m_boneSkinningTrans[i]));

   /* do skinning */
   for (j = 0; j < m_numVertex; j++) {
      if (m_boneWeight1[j] >= 1.0f - PMDMODEL_MINBONEWEIGHT) {
         /* bone 1 */
         m_skinnedVertexList[j] = m_boneSkinningTrans[m_bone1List[j]] * m_vertexList[j];
         m_skinnedNormalList[j] = m_boneSkinningTrans[m_bone1List[j]].getBasis() * m_normalList[j];
      } else if (m_boneWeight1[j] <= PMDMODEL_MINBONEWEIGHT) {
         /* bone 2 */
         m_skinnedVertexList[j] = m_boneSkinningTrans[m_bone2List[j]] * m_vertexList[j];
         m_skinnedNormalList[j] = m_boneSkinningTrans[m_bone2List[j]].getBasis() * m_normalList[j];
      } else {
         /* lerp */
         v = m_boneSkinningTrans[m_bone1List[j]] * m_vertexList[j];
         n = m_boneSkinningTrans[m_bone1List[j]].getBasis() * m_normalList[j];
         v2 = m_boneSkinningTrans[m_bone2List[j]] * m_vertexList[j];
         n2 = m_boneSkinningTrans[m_bone2List[j]].getBasis() * m_normalList[j];
         m_skinnedVertexList[j] = v2.lerp(v, m_boneWeight1[j]);
         m_skinnedNormalList[j] = n2.lerp(n, m_boneWeight1[j]);
      }
   }
}

/* PMDModel::updateToon: update toon coordinates and edge vertices */
void PMDModel::updateToon(btVector3 *light)
{
   unsigned long i;

   if (m_toon) {
      /* calculate toon texture coordinates for toon shading */
      for (i = 0; i < m_numVertex; i++) {
         m_toonTexCoordList[i].u = 0.0f;
         m_toonTexCoordList[i].v = (1.0f - light->dot(m_skinnedNormalList[i])) * 0.5f;
      }
      /* calculate vertices for edge drawing */
      for (i = 0; i < m_numVertex; i++) {
         /* not push vertices with no edge flag */
         if (m_noEdgeFlag[i] == 1)
            m_edgeVertexList[i] = m_skinnedVertexList[i];
         else
            m_edgeVertexList[i] = m_skinnedVertexList[i] + m_skinnedNormalList[i] * m_edgeOffset;
      }
   }
}

/* PMDModel::updateShadowColorTexCoord: update / create pseudo toon coordinates for shadow rendering pass on shadow mapping */
void PMDModel::updateShadowColorTexCoord(float coef)
{
   unsigned long i;
   bool update = false;

   if (!m_toon) return;

   if (m_toonTexCoordListForShadowMap == NULL) {
      m_toonTexCoordListForShadowMap = (TexCoord *) malloc(sizeof(TexCoord) * m_numVertex);
      update = true;
   } else if (m_selfShadowDensityCoef != coef) {
      update = true;
   }

   if (update) {
      for (i = 0 ; i < m_numVertex ; i++) {
         m_toonTexCoordListForShadowMap[i].u = 0.0f;
         m_toonTexCoordListForShadowMap[i].v = coef;
      }
      m_selfShadowDensityCoef = coef;
   }
}

/* PMDModel::calculateBoundingSphereRange: calculate the bounding sphere for depth texture rendering on shadow mapping */
float PMDModel::calculateBoundingSphereRange(btVector3 *cpos)
{
   unsigned long i;
   btVector3 centerPos = btVector3(0, 0, 0), v;
   float maxR = 0.0f, r2;

   if (m_centerBone) {
      centerPos = m_centerBone->getTransform()->getOrigin();
      for (i = 0; i < m_numVertex; i += m_boundingSphereStep) {
         r2 = centerPos.distance2(m_skinnedVertexList[i]);
         if (maxR < r2) maxR = r2;
      }
      maxR = sqrtf(maxR) * 1.1f;
   } else {
      maxR = 0.0f;
   }

   if (cpos) *cpos = centerPos;

   return maxR;
}

/* PMDModel::smearAllBonesToDefault: smear all bone pos/rot into default value (rate 1.0 = keep, rate 0.0 = reset) */
void PMDModel::smearAllBonesToDefault(float rate)
{
   unsigned short i;
   const btVector3 v(0.0f, 0.0f, 0.0f);
   const btQuaternion q(0.0f, 0.0f, 0.0f, 1.0f);
   btVector3 tmpv;
   btQuaternion tmpq;

   for (i = 0; i < m_numBone; i++) {
      m_boneList[i].getCurrentPosition(&tmpv);
      tmpv = v.lerp(tmpv, rate);
      m_boneList[i].setCurrentPosition(&tmpv);
      m_boneList[i].getCurrentRotation(&tmpq);
      tmpq = q.slerp(tmpq, rate);
      m_boneList[i].setCurrentRotation(&tmpq);
   }
   for (i = 0; i < m_numFace; i++) {
      m_faceList[i].setWeight(m_faceList[i].getWeight() * rate);
   }
}

#ifndef MMDFILES_DONTSORTORDERFORALPHARENDERING
/* compareAlphaDepth: qsort function for reordering material */
static int compareAlphaDepth(const void *a, const void *b)
{
   MaterialDistanceData *x = (MaterialDistanceData *) a;
   MaterialDistanceData *y = (MaterialDistanceData *) b;

   if (x->alpha < 1.0f && y->alpha < 1.0f) {
      if (x->dist == y->dist)
         return 0;
      return ( (x->dist > y->dist) ? 1 : -1 );
   } else if (x->alpha == 1.0f && y->alpha < 1.0f) {
      return -1;
   } else if (x->alpha < 1.0f && y->alpha == 1.0f) {
      return 1;
   } else {
      return 0;
   }
}
#endif /* !MMDFILES_DONTSORTORDERFORALPHARENDERING */

/* PMDModel::updateMaterialOrder: update material order */
void PMDModel::updateMaterialOrder(btTransform *trans)
{
#ifndef MMDFILES_DONTSORTORDERFORALPHARENDERING
   unsigned long i;
   btVector3 pos;

   for (i = 0; i < m_numMaterial; i++) {
      pos = m_skinnedVertexList[m_material[i].getCenterPositionIndex()];
      pos = *trans * pos;
      m_materialDistance[i].dist = pos.z() + m_material[i].getCenterVertexRadius();
      if (m_material[i].getAlpha() == 1.0f && m_material[i].getTexture() != NULL && m_material[i].getTexture()->isTransparent())
         m_materialDistance[i].alpha = 0.99f;
      else
         m_materialDistance[i].alpha = m_material[i].getAlpha();
      m_materialDistance[i].id = i;
   }
   qsort(m_materialDistance, m_numMaterial, sizeof(MaterialDistanceData), compareAlphaDepth);
   for (i = 0; i < m_numMaterial; i++)
      m_materialRenderOrder[i] = m_materialDistance[i].id;
#endif /* !MMDFILES_DONTSORTORDERFORALPHARENDERING */
}

/* PMDModel::getMaterialRenderOrder: get material rendering order */
unsigned long *PMDModel::getMaterialRenderOrder()
{
   return m_materialRenderOrder;
}


text:
@implementation MXEXmlChildNodePath

#pragma mark - NSObject (Override)

- (NSString* _Nonnull)description
{
    return [NSString stringWithFormat:@"MXEXmlChildNode(%@)", [super description]];
}

@end

redpajama_set_name: RedPajamaGithub


text:
<?php
declare(strict_types=1);

namespace CosmonovaRnD\CasparCG\Command\Basic\Builder;

/**
 * Class PauseBuilder
 *
 * @author  Aleksandr Besedin <bs@cosmonova.net>
 * @package CosmonovaRnD\CasparCG\Command\Basic\Builder
 * Cosmonova | Research & Development
 *
 * @see     http://casparcg.com/wiki/CasparCG_2.0_AMCP_Protocol#PAUSE
 */
class PauseBuilder extends BaseBuilder
{
    /**
     * @inheritDoc
     */
    public function build(bool $legacy = false): string
    {
        $commandParts[] = 'PAUSE';
        $commandParts[] = $this->buildChannel();

        $commandParts = array_filter($commandParts);

        return implode(' ', $commandParts);
    }
}


text:
ActionController::Base.session = {
  :key         => '_cincy_rb_store_session',
  :secret      => 'afcecedc542bc2a1a9e5bb1054e6673b045cd8429338657d710065892a74099c313ea5913b2eda40e48a1a89d06255cb999c1eed8e1ee19ac14ee1b50c64e1a7'
}

# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake db:sessions:create")
# ActionController::Base.session_store = :active_record_store


text:
from telemetry import decorators
from telemetry.testing import tab_test_case
from telemetry.util import image_util

class InspectorPageTest(tab_test_case.TabTestCase):
  def testPageNavigateToNormalUrl(self):
    self.Navigate('blank.html')

  def testCustomActionToNavigate(self):
    self.Navigate('page_with_link.html')
    self.assertEquals(
        self._tab.EvaluateJavaScript('document.location.pathname;'),
        '/page_with_link.html')

    self._tab.ExecuteJavaScript('document.getElementById("clickme").click();')
    self._tab.WaitForNavigate()

    self.assertEquals(
        self._tab.EvaluateJavaScript('document.location.pathname;'),
        '/blank.html')

  def testGetCookieByName(self):
    self.Navigate('blank.html')
    self._tab.ExecuteJavaScript('document.cookie="foo=bar"')
    self.assertEquals(self._tab.GetCookieByName('foo'), 'bar')

  def testScriptToEvaluateOnCommit(self):
    self.Navigate('blank.html',
                  script_to_evaluate_on_commit='var foo = "bar";')
    self._tab.WaitForDocumentReadyStateToBeComplete()
    self.assertEquals(self._tab.EvaluateJavaScript('foo'), 'bar')

  @decorators.Disabled('chromeos', 'mac')  # crbug.com/483212, crbug.com/736628
  def testCaptureScreenshot(self):
    if not self._tab.screenshot_supported:
      return
    self.Navigate('green_rect.html')
    res = image_util.Pixels(self._tab.Screenshot())
    self.assertEquals(0x00, res[0])
    self.assertEquals(0xFF, res[1])
    self.assertEquals(0x00, res[2])


text:
#include "ux_internal.h"

typedef struct ux_default_data_simulator_s ux_default_data_simulator_t;

static const char *data_simulator_name = "DataSimulator";
static const char *data_simulator_desc = "Default data simulator";
static const char *data_simulator_url = "www.dailypips.org";

struct ux_default_data_simulator_s {
    UX_DATA_SIMULATOR_PUBLIC_FIELDS
    char *name;
    char *description;
    char *url;
    ux_provider_status status;
    int enabled;
};

static ux_provider_status get_status(ux_provider_t *provider)
{
    ux_default_data_simulator_t *simulator = (ux_default_data_simulator_t*)provider;
    return simulator->status;
}

static void set_status(ux_provider_t *provider, ux_provider_status status)
{
    ux_default_data_simulator_t *simulator = (ux_default_data_simulator_t*)provider;
    if (status != simulator->status) {
        ux_provider_status old = simulator->status;
        simulator->status = status;
        // notify status changed
        // TODO
    }
}

/* provider */
static int is_enable(ux_provider_t *provider)
{

}

static int get_id(ux_provider_t *provider)
{

}

const char* get_name(ux_provider_t *provider)
{

}

static ux_provider_status get_status(ux_provider_t *provider)
{

}

static void connect(ux_provider_t *provider, ux_provider_cb on_connect)
{
    ux_default_data_simulator_t *simulator = (ux_default_data_simulator_t*)provider;
    if(simulator->enabled && simulator->status == UX_PROVIDER_STATUS_DISCONNECTED) {
        set_status(provider, UX_PROVIDER_STATUS_CONNECTED);
        on_connect(provider, UX_OK);
    }
}

static void disconnect(ux_provider_t *provider, ux_provider_cb on_disconnect)
{

}

static void subscribe(ux_data_provider_t *provider, ux_instrument_t *instrument, int level2_flag, ux_provider_cb on_subscribe)
{

}

static void unsubscribe(ux_data_provider_t *provider, ux_instrument_t *instrument, ux_provider_cb on_unsubscribe)
{

}

static void run(ux_data_simulator_t *simulator)
{

}

static void clear(ux_data_simulator_t *simulator)
{

}

void ux_default_data_simulator_init(ux_default_data_simulator_t *simulator)
{
    /* set callbacks */
    simulator->is_enable = is_enable;
    simulator->get_id = get_id;
    simulator->get_name = get_name;
    simulator->get_status = get_status;
    simulator->connect = connect;
    simulator->disconnect = disconnect;
    simulator->subscribe = subscribe;
    simulator->unsubscribe = unsubscribe;
    simulator->run = run;
    simulator->clear = clear;
    simulator->name =data_simulator_name;
    simulator->description = data_simulator_desc;
    /* set info */
    simulator->url = data_simulator_url;
    simulator->time1 = MIN_DATE_TIME;
    simulator->time2 = MAX_DATE_TIME;
}

void ux_default_data_simulator_destory(ux_default_data_simulator_t *simulator)
{

}


text:
/*
   Concepts and parts of this file have been contributed by Andre R.
 */

/**
 * @file    cmsis_os.c
 * @brief   CMSIS RTOS module code.
 *
 * @addtogroup CMSIS_OS
 * @{
 */

#include "cmsis_os.h"
#include <string.h>

/*===========================================================================*/
/* Module local definitions.                                                 */
/*===========================================================================*/

/*===========================================================================*/
/* Module exported variables.                                                */
/*===========================================================================*/

int32_t cmsis_os_started;

/*===========================================================================*/
/* Module local types.                                                       */
/*===========================================================================*/

/*===========================================================================*/
/* Module local variables.                                                   */
/*===========================================================================*/

static memory_pool_t sempool;
static semaphore_t semaphores[CMSIS_CFG_NUM_SEMAPHORES];

static memory_pool_t timpool;
static struct os_timer_cb timers[CMSIS_CFG_NUM_TIMERS];

/*===========================================================================*/
/* Module local functions.                                                   */
/*===========================================================================*/

/**
 * @brief   Virtual timers common callback.
 */
static void timer_cb(void const *arg) {

  osTimerId timer_id = (osTimerId)arg;
  timer_id->ptimer(timer_id->argument);
  if (timer_id->type == osTimerPeriodic) {
    chSysLockFromISR();
    chVTDoSetI(&timer_id->vt, MS2ST(timer_id->millisec),
               (vtfunc_t)timer_cb, timer_id);
    chSysUnlockFromISR();
  }
}

/*===========================================================================*/
/* Module exported functions.                                                */
/*===========================================================================*/

/**
 * @brief   Kernel initialization.
 */
osStatus osKernelInitialize(void) {

  cmsis_os_started = 0;

  chSysInit();
  chThdSetPriority(HIGHPRIO);

  chPoolObjectInit(&sempool, sizeof(semaphore_t), chCoreAlloc);
  chPoolLoadArray(&sempool, semaphores, CMSIS_CFG_NUM_SEMAPHORES);

  chPoolObjectInit(&timpool, sizeof(virtual_timer_t), chCoreAlloc);
  chPoolLoadArray(&timpool, timers, CMSIS_CFG_NUM_TIMERS);

  return osOK;
}

/**
 * @brief   Kernel start.
 */
osStatus osKernelStart(void) {

  cmsis_os_started = 1;

  chThdSetPriority(NORMALPRIO);

  return osOK;
}

/**
 * @brief   Creates a thread.
 */
osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *argument) {
  size_t size;

  size = thread_def->stacksize == 0 ? CMSIS_CFG_DEFAULT_STACK :
                                      thread_def->stacksize;
  return (osThreadId)chThdCreateFromHeap(0,
                                         THD_WORKING_AREA_SIZE(size),
                                         NORMALPRIO+thread_def->tpriority,
                                         (tfunc_t)thread_def->pthread,
                                         argument);
}

/**
 * @brief   Thread termination.
 * @note    The thread is not really terminated but asked to terminate which
 *          is not compliant.
 */
osStatus osThreadTerminate(osThreadId thread_id) {

  if (thread_id == osThreadGetId()) {
    /* Note, no memory will be recovered unless a cleaner thread is
       implemented using the registry.*/
    chThdExit(0);
  }
  chThdTerminate(thread_id);
  chThdWait((thread_t *)thread_id);

  return osOK;
}

/**
 * @brief   Change thread priority.
 * @note    This can interfere with the priority inheritance mechanism.
 */
osStatus osThreadSetPriority(osThreadId thread_id, osPriority newprio) {
  osPriority oldprio;
  thread_t * tp = (thread_t *)thread_id;

  chSysLock();

  /* Changing priority.*/
#if CH_CFG_USE_MUTEXES
  oldprio = (osPriority)tp->p_realprio;
  if ((tp->p_prio == tp->p_realprio) || ((tprio_t)newprio > tp->p_prio))
    tp->p_prio = (tprio_t)newprio;
  tp->p_realprio = (tprio_t)newprio;
#else
  oldprio = tp->p_prio;
  tp->p_prio = (tprio_t)newprio;
#endif

  /* The following states need priority queues reordering.*/
  switch (tp->p_state) {
#if CH_CFG_USE_MUTEXES |                                                    \
    CH_CFG_USE_CONDVARS |                                                   \
    (CH_CFG_USE_SEMAPHORES && CH_CFG_USE_SEMAPHORES_PRIORITY) |             \
    (CH_CFG_USE_MESSAGES && CH_CFG_USE_MESSAGES_PRIORITY)
#if CH_CFG_USE_MUTEXES
  case CH_STATE_WTMTX:
#endif
#if CH_CFG_USE_CONDVARS
  case CH_STATE_WTCOND:
#endif
#if CH_CFG_USE_SEMAPHORES && CH_CFG_USE_SEMAPHORES_PRIORITY
  case CH_STATE_WTSEM:
#endif
#if CH_CFG_USE_MESSAGES && CH_CFG_USE_MESSAGES_PRIORITY
  case CH_STATE_SNDMSGQ:
#endif
    /* Re-enqueues tp with its new priority on the queue.*/
    queue_prio_insert(queue_dequeue(tp),
                      (threads_queue_t *)tp->p_u.wtobjp);
    break;
#endif
  case CH_STATE_READY:
#if CH_DBG_ENABLE_ASSERTS
    /* Prevents an assertion in chSchReadyI().*/
    tp->p_state = CH_STATE_CURRENT;
#endif
    /* Re-enqueues tp with its new priority on the ready list.*/
    chSchReadyI(queue_dequeue(tp));
    break;
  }

  /* Rescheduling.*/
  chSchRescheduleS();

  chSysUnlock();

  return oldprio;
}

/**
 * @brief   Create a timer.
 */
osTimerId osTimerCreate(const osTimerDef_t *timer_def,
                        os_timer_type type,
                        void *argument) {

  osTimerId timer = chPoolAlloc(&timpool);
  chVTObjectInit(&timer->vt);
  timer->ptimer = timer_def->ptimer;
  timer->type = type;
  timer->argument = argument;
  return timer;
}

/**
 * @brief   Start a timer.
 */
osStatus osTimerStart(osTimerId timer_id, uint32_t millisec) {

  if (millisec == 0)
    return osErrorValue;

  timer_id->millisec = millisec;
  chVTSet(&timer_id->vt, MS2ST(millisec), (vtfunc_t)timer_cb, timer_id);

  return osOK;
}

/**
 * @brief   Stop a timer.
 */
osStatus osTimerStop(osTimerId timer_id) {

  chVTReset(&timer_id->vt);

  return osOK;
}

/**
 * @brief   Delete a timer.
 */
osStatus osTimerDelete(osTimerId timer_id) {

  chVTReset(&timer_id->vt);
  chPoolFree(&timpool, (void *)timer_id);

  return osOK;
}

/**
 * @brief   Send signals.
 */
int32_t osSignalSet(osThreadId thread_id, int32_t signals) {
  int32_t oldsignals;

  syssts_t sts = chSysGetStatusAndLockX();
  oldsignals = (int32_t)thread_id->p_epending;
  chEvtSignalI((thread_t *)thread_id, (eventmask_t)signals);
  chSysRestoreStatusX(sts);

  return oldsignals;
}

/**
 * @brief   Clear signals.
 */
int32_t osSignalClear(osThreadId thread_id, int32_t signals) {
  eventmask_t m;

  chSysLock();

  m = thread_id->p_epending & (eventmask_t)signals;
  thread_id->p_epending &= ~(eventmask_t)signals;

  chSysUnlock();

  return (int32_t)m;
}

/**
 * @brief   Wait for signals.
 */
osEvent osSignalWait(int32_t signals, uint32_t millisec) {
  osEvent event;
  systime_t timeout = millisec == 0 ? TIME_INFINITE : MS2ST(millisec);

  if (signals == 0)
    event.value.signals = (uint32_t)chEvtWaitAnyTimeout(ALL_EVENTS, timeout);
  else
    event.value.signals = (uint32_t)chEvtWaitAllTimeout((eventmask_t)signals,
                                                        timeout);

  /* Type of event.*/
  if (event.value.signals == 0)
    event.status = osEventTimeout;
  else
    event.status = osEventSignal;

  return event;
}

/**
 * @brief   Create a semaphore.
 * @note    @p semaphore_def is not used.
 * @note    Can involve memory allocation.
 */
osSemaphoreId osSemaphoreCreate(const osSemaphoreDef_t *semaphore_def,
                                int32_t count) {

  (void)semaphore_def;

  semaphore_t *sem = chPoolAlloc(&sempool);
  chSemObjectInit(sem, (cnt_t)count);
  return sem;
}

/**
 * @brief   Wait on a semaphore.
 */
int32_t osSemaphoreWait(osSemaphoreId semaphore_id, uint32_t millisec) {
  systime_t timeout = millisec == 0 ? TIME_INFINITE : MS2ST(millisec);

  msg_t msg = chSemWaitTimeout((semaphore_t *)semaphore_id, timeout);
  switch (msg) {
  case MSG_OK:
    return osOK;
  case MSG_TIMEOUT:
    return osErrorTimeoutResource;
  }
  return osErrorResource;
}

/**
 * @brief   Release a semaphore.
 */
osStatus osSemaphoreRelease(osSemaphoreId semaphore_id) {

  syssts_t sts = chSysGetStatusAndLockX();
  chSemSignalI((semaphore_t *)semaphore_id);
  chSysRestoreStatusX(sts);

  return osOK;
}

/**
 * @brief   Deletes a semaphore.
 * @note    After deletion there could be references in the system to a
 *          non-existent semaphore.
 */
osStatus osSemaphoreDelete(osSemaphoreId semaphore_id) {

  chSemReset((semaphore_t *)semaphore_id, 0);
  chPoolFree(&sempool, (void *)semaphore_id);

  return osOK;
}

/**
 * @brief   Create a mutex.
 * @note    @p mutex_def is not used.
 * @note    Can involve memory allocation.
 */
osMutexId osMutexCreate(const osMutexDef_t *mutex_def) {

  (void)mutex_def;

  binary_semaphore_t *mtx = chPoolAlloc(&sempool);
  chBSemObjectInit(mtx, false);
  return mtx;
}

/**
 * @brief   Wait on a mutex.
 */
osStatus osMutexWait(osMutexId mutex_id, uint32_t millisec) {
  systime_t timeout = millisec == 0 ? TIME_INFINITE : MS2ST(millisec);

  msg_t msg = chBSemWaitTimeout((binary_semaphore_t *)mutex_id, timeout);
  switch (msg) {
  case MSG_OK:
    return osOK;
  case MSG_TIMEOUT:
    return osErrorTimeoutResource;
  }
  return osErrorResource;
}

/**
 * @brief   Release a mutex.
 */
osStatus osMutexRelease(osMutexId mutex_id) {

  syssts_t sts = chSysGetStatusAndLockX();
  chBSemSignalI((binary_semaphore_t *)mutex_id);
  chSysRestoreStatusX(sts);

  return osOK;
}

/**
 * @brief   Deletes a mutex.
 * @note    After deletion there could be references in the system to a
 *          non-existent semaphore.
 */
osStatus osMutexDelete(osMutexId mutex_id) {

  chSemReset((semaphore_t *)mutex_id, 0);
  chPoolFree(&sempool, (void *)mutex_id);

  return osOK;
}

/**
 * @brief   Create a memory pool.
 * @note    The pool is not really created because it is allocated statically,
 *          this function just re-initializes it.
 */
osPoolId osPoolCreate(const osPoolDef_t *pool_def) {

  chPoolObjectInit(pool_def->pool, (size_t)pool_def->item_sz, NULL);
  chPoolLoadArray(pool_def->pool, pool_def->items, (size_t)pool_def->pool_sz);

  return (osPoolId)pool_def->pool;
}

/**
 * @brief   Allocate an object.
 */
void *osPoolAlloc(osPoolId pool_id) {
  void *object;

  syssts_t sts = chSysGetStatusAndLockX();
  object = chPoolAllocI((memory_pool_t *)pool_id);
  chSysRestoreStatusX(sts);

  return object;
}

/**
 * @brief   Allocate an object clearing it.
 */
void *osPoolCAlloc(osPoolId pool_id) {
  void *object;

  object = chPoolAllocI((memory_pool_t *)pool_id);
  memset(object, 0, pool_id->mp_object_size);
  return object;
}

/**
 * @brief   Free an object.
 */
osStatus osPoolFree(osPoolId pool_id, void *block) {

  syssts_t sts = chSysGetStatusAndLockX();
  chPoolFreeI((memory_pool_t *)pool_id, block);
  chSysRestoreStatusX(sts);

  return osOK;
}

/**
 * @brief   Create a message queue.
 * @note    The queue is not really created because it is allocated statically,
 *          this function just re-initializes it.
 */
osMessageQId osMessageCreate(const osMessageQDef_t *queue_def,
                             osThreadId thread_id) {

  /* Ignoring this parameter for now.*/
  (void)thread_id;

  if (queue_def->item_sz > sizeof (msg_t))
    return NULL;

  chMBObjectInit(queue_def->mailbox,
                 queue_def->items,
                 (size_t)queue_def->queue_sz);

  return osOK;
}

/**
 * @brief   Put a message in the queue.
 */
osStatus osMessagePut(osMessageQId queue_id,
                      uint32_t info,
                      uint32_t millisec) {
  msg_t msg;
  systime_t timeout = millisec == 0 ? TIME_INFINITE : MS2ST(millisec);

  if (port_is_isr_context()) {

    /* Waiting makes no sense in ISRs so any value except "immediate"
       makes no sense.*/
    if (millisec != 0)
      return osErrorValue;

    chSysLockFromISR();
    msg = chMBPostI((mailbox_t *)queue_id, (msg_t)info);
    chSysUnlockFromISR();
  }
  else
    msg = chMBPost((mailbox_t *)queue_id, (msg_t)info, timeout);

  return msg == MSG_OK ? osOK : osEventTimeout;
}

/**
 * @brief   Get a message from the queue.
 */
osEvent osMessageGet(osMessageQId queue_id,
                     uint32_t millisec) {
  msg_t msg;
  osEvent event;
  systime_t timeout = millisec == 0 ? TIME_INFINITE : MS2ST(millisec);

  event.def.message_id = queue_id;

  if (port_is_isr_context()) {

    /* Waiting makes no sense in ISRs so any value except "immediate"
       makes no sense.*/
    if (millisec != 0) {
      event.status = osErrorValue;
      return event;
    }

    chSysLockFromISR();
    msg = chMBFetchI((mailbox_t *)queue_id, (msg_t*)&event.value.v);
    chSysUnlockFromISR();
  }
  else {
    msg = chMBFetch((mailbox_t *)queue_id, (msg_t*)&event.value.v, timeout);
  }

  /* Returned event type.*/
  event.status = msg == MSG_OK ? osEventMessage : osEventTimeout;
  return event;
}

/** @} */


text:
<?xml version="1.0" encoding="UTF-8"?>
<Tokens version="1.0">
	<File path="Classes/AWSEC2AttributeValue.html">

		<Token>
			<TokenIdentifier>//apple_ref/occ/cl/AWSEC2AttributeValue</TokenIdentifier>
			<Abstract type="html">
The value to use for a resource attribute.
</Abstract>
			<DeclaredIn>AWSEC2Model.h</DeclaredIn>

			<NodeRef refid="382"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/AWSEC2AttributeValue/setValue:</TokenIdentifier>
			<Abstract type="html">
Valid values are case-sensitive and vary by action.
</Abstract>
			<DeclaredIn>AWSEC2Model.h</DeclaredIn>

			<Declaration>@property (nonatomic, strong) NSString *value</Declaration>

			<Anchor>//api/name/value</Anchor>
            <NodeRef refid="382"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instm/AWSEC2AttributeValue/value</TokenIdentifier>
			<Abstract type="html">
Valid values are case-sensitive and vary by action.
</Abstract>
			<DeclaredIn>AWSEC2Model.h</DeclaredIn>

			<Declaration>@property (nonatomic, strong) NSString *value</Declaration>

			<Anchor>//api/name/value</Anchor>
            <NodeRef refid="382"/>
		</Token>

		<Token>
			<TokenIdentifier>//apple_ref/occ/instp/AWSEC2AttributeValue/value</TokenIdentifier>
			<Abstract type="html">
Valid values are case-sensitive and vary by action.
</Abstract>
			<DeclaredIn>AWSEC2Model.h</DeclaredIn>

			<Declaration>@property (nonatomic, strong) NSString *value</Declaration>

			<Anchor>//api/name/value</Anchor>
            <NodeRef refid="382"/>
		</Token>

	</File>
</Tokens>


text:
name              "civicrm"
maintainer        "OpenStreetMap Administrators"
maintainer_email  "admins@openstreetmap.org"
license           "Apache-2.0"
description       "Installs and configures CiviCRM"

version           "1.0.0"
supports          "ubuntu"
depends           "wordpress"
depends           "mysql"


text:
<?php

namespace Drupal\Core\Routing\Access;

/**
 * An access check service determines access rules for particular routes.
 */
interface AccessInterface {

  // @todo Remove this interface since it no longer defines any methods?
  // @see https://www.drupal.org/node/2266817.

}


text:
require_relative 'version_helper'

module MSDotNet
  # Provides information about .NET 2 setup
  class V2Helper < VersionHelper
    REGISTRY_KEY = 'HKLM\Software\Microsoft\Net Framework Setup\NDP\v2.0.50727'.freeze unless defined? REGISTRY_KEY

    def installed_version
      return unless registry_key_exists? REGISTRY_KEY

      values = ::Mash[registry_get_values(REGISTRY_KEY).map { |e| [e[:name], e[:data]] }]
      return if values[:Install].to_i != 1

      case sp = values[:SP].to_i
        when 0 then '2.0'
        else "2.0.SP#{sp}"
      end
    end

    def supported_versions
      @supported_versions ||= %w(2.0.SP2)
    end

    protected

    def feature_names
      @feature_names ||= if 6.0 == nt_version && server?
        %w(NET-Framework-Core)
      elsif nt_version.between?(6.0, 6.1) && core?
        x64? ? %w(NetFx2-ServerCore NetFx2-ServerCore-WOW64) : %w(NetFx2-ServerCore)
      else
        []
      end
    end

    def feature_setup
      @feature_setup ||= case nt_version
        # Windows Vista & Server 2008
        when 6.0, 6.1 then %w(2.0.SP2)
        # Other versions
        else []
      end
    end

    def patch_names
      @patch_names ||= {}
    end

    def package_setup
      @package_setup ||= case nt_version
        # Windows XP & Windows Server 2003
        when 5.1, 5.2 then %w(2.0.SP2)
        # Other versions
        else []
      end
    end

    def prerequisite_names
      @prerequisite_names ||= {}
    end
  end
end


text:
namespace Highcharts4Net.Library.Options
{
    public class PlotOptionsGaugeMarkerStates: PlotOptionsGaugeStates
    {
    }
}


text:
var htmlCodify = require('../src/html-codify-stream.js');
var concat = require('concat-stream');
var cheerio = require('cheerio');
var fs = require('fs');
var path = require('path');

describe('Html stream transformer', function () {
  it('should pass normal HTML through unscathed', function (done) {
    var outStream = concat(function(html) {
      var $ = cheerio.load(html);
      // We can tell if pygments has run if there are a bunch of spans
      // generated inside a code tag
      $('code span').length.should.equal(0);

      // The existing elements should exist in the output
      $('h1').length.should.equal(2);
      $('h2').length.should.equal(2);
      $('p').length.should.equal(4);

      done();
    });

    var inStream = fs.createReadStream(path.join(__dirname,
      './resources/nocode.html'));
    var htmlStream = htmlCodify();
    htmlStream.on('error', function(error) {
      throw new Error(error);
    });
    inStream.pipe(htmlStream).pipe(outStream);
  });

  it('should pygmentize code blocks', function (done) {
    var outStream = concat(function(html) {
      var $ = cheerio.load(html);
      $('.lang-js span').length.should.be.greaterThan(0);
      done();
    });

    var inStream = fs.createReadStream(path.join(__dirname,
      './resources/code.html'));
    var htmlStream = htmlCodify();
    htmlStream.on('error', function(error) {
      throw new Error(error);
    });
    inStream.pipe(htmlStream).pipe(outStream);
  });

  it('should pygmentize inline code blocks', function (done) {
    var outStream = concat(function(html) {
      var $ = cheerio.load(html);
      $('.lang-html span').length.should.be.greaterThan(0);
      done();
    });

    var inStream = fs.createReadStream(path.join(__dirname,
      './resources/code.html'));
    var htmlStream = htmlCodify();
    htmlStream.on('error', function(error) {
      throw new Error(error);
    });
    inStream.pipe(htmlStream).pipe(outStream);
  });

  it('should emit a stream error for an invalid language', function (done) {
    var gotError = false;
    var outStream = concat(function(html) {
      gotError.should.be.truthy;
      done();
    });

    var inStream = fs.createReadStream(path.join(__dirname,
      './resources/code-invalid-lang.html'));
    var htmlStream = htmlCodify();
    htmlStream.on('error', function(error) {
      // If we got an error for this file, it's emitting the language-invalid error
      error.message.should.containEql('no lexer for alias');
      gotError = true;
    });
    inStream.pipe(htmlStream).pipe(outStream);
  });
});


text:
import { PDBeStructureQualityReport } from '../../extensions/pdbe';
import { EmptyLoci } from '../../mol-model/loci';
import { StructureSelection } from '../../mol-model/structure';
import { AnimateModelIndex } from '../../mol-plugin-state/animation/built-in/model-index';
import { BuiltInTrajectoryFormat } from '../../mol-plugin-state/formats/trajectory';
import { createPluginUI } from '../../mol-plugin-ui/react18';
import { PluginUIContext } from '../../mol-plugin-ui/context';
import { DefaultPluginUISpec } from '../../mol-plugin-ui/spec';
import { PluginCommands } from '../../mol-plugin/commands';
import { Script } from '../../mol-script/script';
import { Asset } from '../../mol-util/assets';
import { Color } from '../../mol-util/color';
import { StripedResidues } from './coloring';
import { CustomToastMessage } from './controls';
import { CustomColorThemeProvider } from './custom-theme';
import './index.html';
import { buildStaticSuperposition, dynamicSuperpositionTest, StaticSuperpositionTestData } from './superposition';
require('mol-plugin-ui/skin/light.scss');

type LoadParams = { url: string, format?: BuiltInTrajectoryFormat, isBinary?: boolean, assemblyId?: string }

class BasicWrapper {
    plugin: PluginUIContext;

    async init(target: string | HTMLElement) {
        this.plugin = await createPluginUI(typeof target === 'string' ? document.getElementById(target)! : target, {
            ...DefaultPluginUISpec(),
            layout: {
                initial: {
                    isExpanded: false,
                    showControls: false
                }
            },
            components: {
                remoteState: 'none'
            }
        });

        this.plugin.representation.structure.themes.colorThemeRegistry.add(StripedResidues.colorThemeProvider!);
        this.plugin.representation.structure.themes.colorThemeRegistry.add(CustomColorThemeProvider);
        this.plugin.managers.lociLabels.addProvider(StripedResidues.labelProvider!);
        this.plugin.customModelProperties.register(StripedResidues.propertyProvider, true);
    }

    async load({ url, format = 'mmcif', isBinary = false, assemblyId = '' }: LoadParams) {
        await this.plugin.clear();

        const data = await this.plugin.builders.data.download({ url: Asset.Url(url), isBinary }, { state: { isGhost: true } });
        const trajectory = await this.plugin.builders.structure.parseTrajectory(data, format);

        await this.plugin.builders.structure.hierarchy.applyPreset(trajectory, 'default', {
            structure: assemblyId ? {
                name: 'assembly',
                params: { id: assemblyId }
            } : {
                name: 'model',
                params: {}
            },
            showUnitcell: false,
            representationPreset: 'auto'
        });
    }

    setBackground(color: number) {
        PluginCommands.Canvas3D.SetSettings(this.plugin, { settings: props => { props.renderer.backgroundColor = Color(color); } });
    }

    toggleSpin() {
        if (!this.plugin.canvas3d) return;

        const trackball = this.plugin.canvas3d.props.trackball;
        PluginCommands.Canvas3D.SetSettings(this.plugin, {
            settings: {
                trackball: {
                    ...trackball,
                    animate: trackball.animate.name === 'spin'
                        ? { name: 'off', params: {} }
                        : { name: 'spin', params: { speed: 1 } }
                }
            }
        });
        if (this.plugin.canvas3d.props.trackball.animate.name !== 'spin') {
            PluginCommands.Camera.Reset(this.plugin, {});
        }
    }

    private animateModelIndexTargetFps() {
        return Math.max(1, this.animate.modelIndex.targetFps | 0);
    }

    animate = {
        modelIndex: {
            targetFps: 8,
            onceForward: () => { this.plugin.managers.animation.play(AnimateModelIndex, { duration: { name: 'computed', params: { targetFps: this.animateModelIndexTargetFps() } }, mode: { name: 'once', params: { direction: 'forward' } } }); },
            onceBackward: () => { this.plugin.managers.animation.play(AnimateModelIndex, { duration: { name: 'computed', params: { targetFps: this.animateModelIndexTargetFps() } }, mode: { name: 'once', params: { direction: 'backward' } } }); },
            palindrome: () => { this.plugin.managers.animation.play(AnimateModelIndex, { duration: { name: 'computed', params: { targetFps: this.animateModelIndexTargetFps() } }, mode: { name: 'palindrome', params: {} } }); },
            loop: () => { this.plugin.managers.animation.play(AnimateModelIndex, { duration: { name: 'computed', params: { targetFps: this.animateModelIndexTargetFps() } }, mode: { name: 'loop', params: { direction: 'forward' } } }); },
            stop: () => this.plugin.managers.animation.stop()
        }
    };

    coloring = {
        applyStripes: async () => {
            this.plugin.dataTransaction(async () => {
                for (const s of this.plugin.managers.structure.hierarchy.current.structures) {
                    await this.plugin.managers.structure.component.updateRepresentationsTheme(s.components, { color: StripedResidues.propertyProvider.descriptor.name as any });
                }
            });
        },
        applyCustomTheme: async () => {
            this.plugin.dataTransaction(async () => {
                for (const s of this.plugin.managers.structure.hierarchy.current.structures) {
                    await this.plugin.managers.structure.component.updateRepresentationsTheme(s.components, { color: CustomColorThemeProvider.name as any });
                }
            });
        },
        applyDefault: async () => {
            this.plugin.dataTransaction(async () => {
                for (const s of this.plugin.managers.structure.hierarchy.current.structures) {
                    await this.plugin.managers.structure.component.updateRepresentationsTheme(s.components, { color: 'default' });
                }
            });
        }
    };

    interactivity = {
        highlightOn: () => {
            const data = this.plugin.managers.structure.hierarchy.current.structures[0]?.cell.obj?.data;
            if (!data) return;

            const seq_id = 7;
            const sel = Script.getStructureSelection(Q => Q.struct.generator.atomGroups({
                'residue-test': Q.core.rel.eq([Q.struct.atomProperty.macromolecular.label_seq_id(), seq_id]),
                'group-by': Q.struct.atomProperty.macromolecular.residueKey()
            }), data);
            const loci = StructureSelection.toLociWithSourceUnits(sel);
            this.plugin.managers.interactivity.lociHighlights.highlightOnly({ loci });
        },
        clearHighlight: () => {
            this.plugin.managers.interactivity.lociHighlights.highlightOnly({ loci: EmptyLoci });
        }
    };

    tests = {
        staticSuperposition: async () => {
            await this.plugin.clear();
            return buildStaticSuperposition(this.plugin, StaticSuperpositionTestData);
        },
        dynamicSuperposition: async () => {
            await this.plugin.clear();
            return dynamicSuperpositionTest(this.plugin, ['1tqn', '2hhb', '4hhb'], 'HEM');
        },
        toggleValidationTooltip: () => {
            return this.plugin.state.updateBehavior(PDBeStructureQualityReport, params => { params.showTooltip = !params.showTooltip; });
        },
        showToasts: () => {
            PluginCommands.Toast.Show(this.plugin, {
                title: 'Toast 1',
                message: 'This is an example text, timeout 3s',
                key: 'toast-1',
                timeoutMs: 3000
            });
            PluginCommands.Toast.Show(this.plugin, {
                title: 'Toast 2',
                message: CustomToastMessage,
                key: 'toast-2'
            });
        },
        hideToasts: () => {
            PluginCommands.Toast.Hide(this.plugin, { key: 'toast-1' });
            PluginCommands.Toast.Hide(this.plugin, { key: 'toast-2' });
        }
    };
}

(window as any).BasicMolStarWrapper = new BasicWrapper();


text:
/*
 *****************************************************************************************/
#ifndef ALIANALYSISTASKSEPPBCORRELATIONSJETV2_DEV
#define ALIANALYSISTASKSEPPBCORRELATIONSJETV2_DEV

#include "AliAnalysisTask.h"
#include "AliLog.h"
#include "AliPID.h"
#include "AliVAD.h"
#include "AliVParticle.h"
#include "TH1.h"
#include "TH2.h"
#include "TH3.h"
#include "TF2.h"
#include "THnSparse.h"
#include "TString.h"
#include "AliEventCuts.h"
#include "AliTrigAssoPairST.h"

class TList;
class AliCFContainer;
// class AliTHn;
class AliAODEvent;
class AliEventPoolManager;
class AliVParticle;
class AliPIDResponse;
// class AliPID;
class AliAODv0;
// class AliAnalyseLeadingTrackUE;
class THnSparse;
class AliAODcascade;
class AliAODVertex;

#ifndef ALIANALYSISTASKSEH
#include "AliAnalysisTaskSE.h"
#endif

//---------------------------------------------------------------------------------------
class AliAnalysisTaskSEpPbCorrelationsJetV2 : public AliAnalysisTaskSE {
public:
  AliAnalysisTaskSEpPbCorrelationsJetV2();
  AliAnalysisTaskSEpPbCorrelationsJetV2(const char *name);
  virtual ~AliAnalysisTaskSEpPbCorrelationsJetV2();

  virtual void UserCreateOutputObjects();
  virtual void UserExec(Option_t *option);
  virtual void Terminate(Option_t *);

  // Analysis Correlation
  void MakeAna();

  // configration
  virtual void SetAnalysisMode(TString mode) { fAnaMode = mode; }
  virtual void SetAssociatedTrack(TString mode) { fasso = mode; }
  virtual void SetPID(Bool_t mode) { fPID = mode; }
  virtual void SetDatatype(Bool_t mode) { fDataType = mode; }
  virtual void SetRunType(Bool_t mode) { frun2 = mode; }
  virtual void SetFilterBit(Int_t mode) { ffilterbit = mode; }
  virtual void SetFMDcut(Bool_t mode) {fFMDcut=mode;}
  virtual void SetFMDcutpar(Int_t mode){fFMDcutmode=mode;}
  virtual void SetReduceDphi(Double_t mode){fReduceDphi=mode;}
  virtual void SetSymmetricFMD(Bool_t mode){fSymmetricFMD=mode;}
  virtual void Set2Dfit(Bool_t mode){fIs2Dfit=mode;}
  virtual void SetPtMax(Float_t mode){fPtMax=mode;}
  virtual void SetPtMin(Float_t mode){fPtMin=mode;}
  virtual void Setacceptancehole(Bool_t mode){fmakehole=mode;}
  virtual void SetAnalysisCent(TString mode) { fCentType = mode; }
  virtual void SetAnalysisCollisionType(TString mode) { fcollisiontype = mode; }

  void SetMaxNEventsInPool(Int_t events) { fPoolMaxNEvents = events; }
  void SetMinNTracksInPool(Int_t tracks) { fPoolMinNTracks = tracks; }
  void SetMinEventsToMix(Int_t events) { fMinEventsToMix = events; }
  void SetCentrality(Double_t cenMin, Double_t cenMax) {fCenMin = cenMin; fCenMax = cenMax;}
  void SetPoolPVzBinLimits(Int_t Nzvtxbins, const Double_t *ZvtxBins) {
    fNzVtxBins = Nzvtxbins;
    for (int ix = 0; ix < fNzVtxBins + 1; ix++) {
      fZvtxBins[ix] = ZvtxBins[ix];
    }
  }

  void SetPoolCentBinLimits(Int_t Ncentbins, const Double_t *CentBins) {
    fNCentBins = Ncentbins;
    for (int ix = 0; ix < fNCentBins + 1; ix++) {
      fCentBins[ix] = CentBins[ix];
    }
  }

  void DumpTObjTable(const char* note);

private:

  AliAnalysisTaskSEpPbCorrelationsJetV2(
      const AliAnalysisTaskSEpPbCorrelationsJetV2 &det);
  AliAnalysisTaskSEpPbCorrelationsJetV2 &
  operator=(const AliAnalysisTaskSEpPbCorrelationsJetV2 &det);

  void DefineGeneralOutput();
  void DefineVZEROOutput();
  void DefineCorrOutput();
  void DefinedQAHistos();

  TObjArray *GetAcceptedTracksLeading(AliAODEvent *faod,Bool_t leading,TObjArray*tracks);
  TObjArray *GetAcceptedTracksPID(AliAODEvent *faod);
  TObjArray *GetAcceptedV0Tracks(const AliAODEvent *faod);
  TObjArray *GetAcceptedCascadeTracks(AliAODEvent *faod);
  TObjArray *GetAcceptedTracksAssociated(AliAODEvent *faod);

  TObjArray* GetFMDhitsYS(Bool_t Aside);
  Bool_t IsAcceptedDaughterTrack(const AliAODTrack *itrack);
  Bool_t IsAcceptedPhiDaughterTrack(const AliAODTrack *itrack);
  Bool_t IsAcceptedTrack(const AliAODTrack *aodTrack);
  Bool_t IsAcceptedDecayLength(const AliAODv0 *aodv0,Double_t mass,Double_t maxctau);
  Bool_t IsAcceptedV0(const AliAODv0 *aodv0);
  Bool_t IsAcceptedCascade(const AliAODcascade *casc);
  Bool_t IsAcceptedCascadeOmega(const AliAODcascade *casc);

  TObjArray* CloneTrack(TObjArray* track);
  Double_t RangePhi(Double_t DPhi);
  Double_t RangePhi_FMD(Double_t DPhi);
  Double_t RangePhi2(Double_t DPhi);
 Int_t      ConvertRunNumber(Int_t run);
  Bool_t NotSPDClusterVsTrackletBG() {return !fUtils.IsSPDClusterVsTrackletBG(this->InputEvent());};

  void FillCorrelationTracks(Double_t MultipOrCent, TObjArray *triggerArray,
                             TObjArray *selectedTrackArray, TObjArray *selectedTrackArray_TPC, AliTHn *triggerHist, AliTHn *associateHist, Bool_t twoTrackEfficiencyCut, Float_t twoTrackEfficiencyCutValue, Float_t fTwoTrackCutMinRadius,Float_t bSign, Int_t step, TObjArray *select_TPCPairs);

  void FillCorrelationTracksMixing(Double_t MultipOrCentMix, Double_t pvxMix,
                                   Double_t poolmax, Double_t poolmin,
                                   TObjArray *triggerArray,
                                   TObjArray *selectedTrackArray,
                                   TObjArray *selectedTrackArray_TPC,
                                   AliTHn *triggerHist, AliTHn *associateHist,
                                   Bool_t, Float_t, Float_t, Float_t, Int_t, TObjArray *select_TPCPairs);

  inline Float_t GetDPhiStar(Float_t phi1, Float_t pt1, Float_t charge1,
                             Float_t phi2, Float_t pt2, Float_t charge2,
                             Float_t radius, Float_t bSign);

  TString fcollisiontype;
  Bool_t fDataType;
  Bool_t frun2;
  Bool_t fQA;
  Bool_t fFMDcut;
  Int_t fFMDcutmode;
  Double_t fReduceDphi;
  Bool_t fmakehole;
  TString fAnaMode;
  TString fasso;
  Bool_t fPID;
  Bool_t fSymmetricFMD;
  Bool_t fIs2Dfit;

  TString fCentType;

  Int_t fNEntries;

  Double_t lCentrality;
  Double_t fCenMax;
  Double_t fCenMin;

  Float_t bSign;
  Double_t fZVertex;

  TList *fOutputList;  // Output list
  TList *fOutputList1; // Output list
  TList *fOutputList2; // Output list

  //AliPIDResponse *fPIDResponse; // PID Response

  Int_t ffilterbit;
  Float_t fnoClusters;
  Float_t fCutChargedDCAzMax;
  Float_t fCutChargedDCAxyMax;
  Double_t fPtMin;
  Double_t fPtMax;
  Double_t fEtaMax;
  Double_t fEtaMaxExtra;
  Double_t fEtaMinExtra;
  // V0 particles
  // V0 daughter cut

  AliEventCuts fEventCuts;
  AliAnalysisUtils fUtils;
  AliAODEvent *fEvent; //  AOD Event
  AliMCEvent* mcEvent;
  AliAODVertex *lPrimaryBestVtx;
  Double_t tPrimaryVtxPosition[3];
  Double_t fPrimaryZVtx;

  AliAODVZERO *fvzero;

  // Event Pool for mixing
  AliEventPoolManager *fPoolMgr;  //  event pool manager for Event Mixing
  AliEventPoolManager *fPoolMgr1; //  event pool manager for Event Mixing
  Double_t poolmin;
  Double_t poolmax;
  Int_t fPoolMaxNEvents;   // set maximum number of events in the pool
  Int_t fPoolMinNTracks;   // set minimum number of tracks in the pool
  Int_t fMinEventsToMix;   // set the minimum number of events want to mix
  Int_t fNzVtxBins;        // number of z vrtx bins
  Double_t fZvtxBins[100]; // [fNzVtxBinsDim]
  Int_t fNCentBins;        // number of centrality bins
  Double_t fCentBins[100]; // [fNCentBinsDim]
  // Track cuts

  // Globaal Histograms
  TH1F *fHistzvertex;
  TH1F *fHistCentrality;
  TH1F *fHistCentrality_beforecut;
  TH1F *fHistCentrality_beforeFMDMulcut;
  TH2F* fHistCentzvertex;
  TH2F* fHistCentV0vsTracklets;
  TH2F* fHistCentV0vsTrackletsbefore;
  TH2F* mixedDist;
  TH2F* mixedDist2;

  //AliTHn *fHistLeadQA;

  AliTHn* fhistmcprim;
  TH2D*fhmcprimvzeta;

  TH1F*frefetac;
  TH1F*frefetaa;
  TH1F*frefvz;
  TH2D*fhcorr[10];

  TH1D*fhrefetaFMD[4];
  TH1D*fhrefphiFMD[4];

  TH2D*  fh2_pt_trig_asso;
  TH2D*  fh2_FMD_eta_phi_prim;
  TH2D*  fh2_FMD_acceptance;
  TH2D*  fh2_ITS_acceptance;
  TH2F*  fh2_SPD_multcorr;
  TH2F*  fh2_SPDV0_multcorr;
  TH2F*  fh2_SPDtrack_multcorr;
  TH1F*  fhtrackletsdphi;
  TH2D*  fh2_FMD_eta_phi;
  TH1F* fHist_NeventRun;
  TH1F* fHist_V0AMultRun;
  TH1F* fHist_V0CMultRun;
  TH1F* fHist_FMDAMultRun;
  TH1F* fHist_FMDCMultRun;

  TH2D*  fhistfmdphiacc;
  TH2F* fhFMDmultchannel;
  TH2F* fhFMDmultchannel_actual;
  TH2D* fhFMDmult_runbyrun_cside[31];
  TH2D* fhFMDmult_runbyrun_aside[65];

  AliTHn* fhistfmd;
  THnSparseF* fhistits;
  AliTHn* fhSecFMD;
  //  const TH2D& d2Ndetadphi;
  TH2F*fFMDV0;
  TH2F*fFMDV0_post;
  TH2F*fFMDV0A;
  TH2F*fFMDV0A_post;
  TH2F*fFMDV0C;
  TH2F*fFMDV0C_post;

  TH2F*fFMDV0same;
  TH2F*fFMDV0same_post;
  TH2F*fFMDV0Asame;
  TH2F*fFMDV0Asame_post;
  TH2F*fFMDV0Csame;
  TH2F*fFMDV0Csame_post;

  TH1F *fHist_Stat;
  TH1F *fHist_V0Stat;

  AliTHn *fHistTriggerTrack;
  AliTHn *fHistReconstTrack;
  AliTHn *fHistTriggerTrackMix;
  AliTHn *fHistReconstTrackMix;

  // only for test of dphi
  TH2D *fTPCTPCdphi_deta_4_2;
/*
  TH1D *fTPCTPCdphi_deta_4_1;
  TH1D *fTPCTPCdphi_deta_4_0;
  TH1D *fTPCTPCdphi_deta_3_2;
  TH1D *fTPCTPCdphi_deta_3_1;
  TH1D *fTPCTPCdphi_deta_3_0;
  TH1D *fTPCTPCdphi_deta_2_2;
*/

  ClassDef(AliAnalysisTaskSEpPbCorrelationsJetV2, 2);
};
//---------------------------------------------------------------------------------------
Float_t AliAnalysisTaskSEpPbCorrelationsJetV2::GetDPhiStar(
    Float_t phi1, Float_t pt1, Float_t charge1, Float_t phi2, Float_t pt2,
    Float_t charge2, Float_t radius, Float_t bSign) {
  //
  // calculates dphistar (Copied from AliUEHistogram)
  //

  Float_t dphistar = phi1 - phi2 -
                     charge1 * bSign * TMath::ASin(0.075 * radius / pt1) +
                     charge2 * bSign * TMath::ASin(0.075 * radius / pt2);

  static const Double_t kPi = TMath::Pi();

  if (dphistar > kPi)
    dphistar = kPi * 2 - dphistar;
  if (dphistar < -kPi)
    dphistar = -kPi * 2 - dphistar;
  if (dphistar > kPi) // might look funny but is needed
    dphistar = kPi * 2 - dphistar;

  return dphistar;
}
/*
class AliAssociatedTPCPairs : public AliVParticle {
public:
  AliAssociatedTPCPairs(Short_t charge, Float_t eta, Float_t phi, Float_t pt, Float_t pt2,
                       Int_t ID, Int_t ID1, Int_t ID2, Short_t candidate,
                       Double_t multiplicity, Double_t deta_pairs, Double_t dphi_pairs)
      : fCharge(charge), fEta(eta), fPhi(phi), fpT(pt), fpT_Asso(pt2), fID(ID), fID1(ID1),
        fID2(ID2), fCandidate(candidate), fMultiplicity(multiplicity), fdeta_pairs(deta_pairs), fdphi_pairs(dphi_pairs) {}
  virtual ~AliAssociatedTPCPairs() {}

  virtual Double_t Px() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Double_t Py() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Double_t Pz() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Double_t Pt() const { return fpT; }
  virtual Double_t P() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Bool_t PxPyPz(Double_t[3]) const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Double_t Xv() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Double_t Yv() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Double_t Zv() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Bool_t XvYvZv(Double_t[3]) const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Double_t OneOverPt() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Double_t Phi() const { return fPhi; }
  virtual Double_t Theta() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Double_t E() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Double_t M() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Double_t Eta() const { return fEta; }
  virtual Double_t Y() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Short_t Charge() const { return fCharge; }
  virtual Int_t GetLabel() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual Int_t PdgCode() const {
    AliFatal("Not implemented");
    return 0;
  }
  virtual const Double_t *PID() const {
    AliFatal("Not implemented");
    return 0;
  }

  virtual Short_t WhichCandidate() const { return fCandidate; }
  virtual Int_t GetID() const { return fID; }
  virtual Int_t GetIDFirstDaughter() const { return fID1; }
  virtual Int_t GetIDSecondDaughter() const { return fID2; }
  virtual Double_t Multiplicity() const { return fMultiplicity; }
  virtual Double_t Getdeta_pairs() const { return fdeta_pairs; }
  virtual Double_t Getdphi_pairs() const { return fdphi_pairs; }
  virtual Double_t Pt_Asso() const { return fpT_Asso; }
private:
  //

  Short_t fCharge;    // Charge
  Float_t fEta;       // Eta
  Float_t fPhi;       // Phi
  Float_t fpT;        // pT
  Float_t fpT_Asso;        // Associate pT
  Float_t fdeta_pairs;        // dEta_Pairs
  Float_t fdphi_pairs;        // dPhi_Pairs
  Int_t fID;          // ID
  Short_t fCandidate; // 1-pi,2-K,3-p
  Double_t fMultiplicity;
  Int_t fID1;
  Int_t fID2;
  ClassDef(AliAssociatedTPCPairs, 1);
};
*/

#endif


text:
package monix.eval

import cats.effect.concurrent.Deferred
import cats.laws._
import cats.laws.discipline._
import cats.syntax.all._
import monix.execution.exceptions.{CompositeException, DummyException}
import monix.execution.internal.Platform
import scala.concurrent.duration._
import scala.util.{Failure, Success}

object TaskBracketSuite extends BaseTestSuite {
  test("equivalence with onErrorHandleWith") { implicit sc =>
    check2 { (task: Task[Int], f: Throwable => Task[Unit]) =>
      val expected = task.onErrorHandleWith(e => f(e) *> Task.raiseError(e))
      val received = task.bracketE(Task.now) {
        case (_, Left(Some(e))) => f(e)
        case (_, _) => Task.unit
      }
      received <-> expected
    }
  }

  test("equivalence with flatMap + transformWith") { implicit sc =>
    check3 { (acquire: Task[Int], f: Int => Task[Int], release: Int => Task[Unit]) =>
      val expected = acquire.flatMap { a =>
        f(a).redeemWith(
          e => release(a) *> Task.raiseError(e),
          s => release(a) *> Task.pure(s)
        )
      }

      val received = acquire.bracket(f)(release)
      received <-> expected
    }
  }

  test("use is protected against user error") { implicit sc =>
    val dummy = new DummyException("dummy")
    var input = Option.empty[(Int, Either[Option[Throwable], Int])]

    val task = Task.evalAsync(1).bracketE(_ => throw dummy) { (a, i) =>
      Task.eval { input = Some((a, i)) }
    }

    val f = task.runToFuture
    sc.tick()

    assertEquals(input, Some((1, Left(Some(dummy)))))
    assertEquals(f.value, Some(Failure(dummy)))
  }

  test("release is evaluated on success") { implicit sc =>
    var input = Option.empty[(Int, Either[Option[Throwable], Int])]
    val task = Task.evalAsync(1).bracketE(x => Task.evalAsync(x + 1)) { (a, i) =>
      Task.eval { input = Some((a, i)) }
    }

    val f = task.runToFuture
    sc.tick()

    assertEquals(input, Some((1, Right(2))))
    assertEquals(f.value, Some(Success(2)))
  }

  test("release is evaluated on error") { implicit sc =>
    val dummy = new DummyException("dummy")
    var input = Option.empty[(Int, Either[Option[Throwable], Int])]

    val task = Task.evalAsync(1).bracketE(_ => Task.raiseError[Int](dummy)) { (a, i) =>
      Task.eval { input = Some((a, i)) }
    }

    val f = task.runToFuture
    sc.tick()

    assertEquals(input, Some((1, Left(Some(dummy)))))
    assertEquals(f.value, Some(Failure(dummy)))
  }

  test("release is evaluated on cancel") { implicit sc =>
    import scala.concurrent.duration._
    var input = Option.empty[(Int, Either[Option[Throwable], Int])]

    val task = Task
      .evalAsync(1)
      .bracketE(x => Task.evalAsync(x + 1).delayExecution(1.second)) { (a, i) =>
        Task.eval { input = Some((a, i)) }
      }

    val f = task.runToFuture
    sc.tick()

    f.cancel()
    sc.tick(1.second)

    assertEquals(f.value, None)
    assertEquals(input, Some((1, Left(None))))
  }

  test("if both use and release throw, report release error, signal use error") { implicit sc =>
    val useError = new DummyException("use")
    val releaseError = new DummyException("release")

    val task = Task
      .evalAsync(1)
      .bracket[Int] { _ =>
        Task.raiseError(useError)
      } { _ =>
        Task.raiseError(releaseError)
      }

    val f = task.runToFuture
    sc.tick()

    f.value match {
      case Some(Failure(error)) =>
        if (Platform.isJVM) {
          assertEquals(error, useError)
          error.getSuppressed match {
            case Array(error2) =>
              assertEquals(error2, releaseError)
            case _ =>
              fail("Unexpected suppressed errors list: " + error.getSuppressed.toList)
          }
        } else
          error match {
            case CompositeException(Seq(`useError`, `releaseError`)) =>
              () // pass
            case _ =>
              fail(s"Unexpected error: $error")
          }

      case other =>
        fail(s"Unexpected result: $other")
    }
  }

  test("bracket works with auto-cancelable run-loops") { implicit sc =>
    import concurrent.duration._

    var effect = 0
    val task = Task(1)
      .bracket(_ => Task.sleep(1.second))(_ => Task(effect += 1))
      .executeWithOptions(_.enableAutoCancelableRunLoops)

    val f = task.runToFuture
    sc.tick()
    assertEquals(f.value, None)

    f.cancel()
    assertEquals(f.value, None)
    assertEquals(effect, 1)
  }

  test("bracket is stack safe (1)") { implicit sc =>
    def loop(n: Int): Task[Unit] =
      if (n > 0)
        Task(n).bracket(n => Task(n - 1))(_ => Task.unit).flatMap(loop)
      else
        Task.unit

    val cycles = if (Platform.isJVM) 100000 else 1000
    val f = loop(cycles).runToFuture

    sc.tick()
    assertEquals(f.value, Some(Success(())))
  }

  test("bracket is stack safe (2)") { implicit sc =>
    val cycles = if (Platform.isJVM) 100000 else 1000
    val bracket = Task.unit.bracket(_ => Task.unit)(_ => Task.unit)
    val task = (0 until cycles).foldLeft(Task.unit) { (acc, _) =>
      acc.flatMap(_ => bracket)
    }

    val f = task.runToFuture
    sc.tick()
    assertEquals(f.value, Some(Success(())))
  }

  test("bracket is stack safe (3)") { implicit sc =>
    val cycles = if (Platform.isJVM) 100000 else 1000
    val task = (0 until cycles).foldLeft(Task.unit) { (acc, _) =>
      acc.bracket(_ => Task.unit)(_ => Task.unit)
    }

    val f = task.runToFuture
    sc.tick()
    assertEquals(f.value, Some(Success(())))
  }

  test("bracket is stack safe (4)") { implicit sc =>
    val cycles = if (Platform.isJVM) 100000 else 1000
    val task = (0 until cycles).foldLeft(Task.unit) { (acc, _) =>
      Task.unit.bracket(_ => acc)(_ => Task.unit)
    }

    val f = task.runToFuture
    sc.tick()
    assertEquals(f.value, Some(Success(())))
  }

  test("use is not evaluated on cancel") { implicit sc =>
    import scala.concurrent.duration._
    var use = false
    var release = false

    val task = Task
      .sleep(2.second)
      .bracket(_ => Task { use = true })(_ => Task { release = true })

    val f = task.runToFuture
    sc.tick()

    f.cancel()
    sc.tick(2.second)

    assertEquals(f.value, None)
    assertEquals(use, false)
    assertEquals(release, true)
  }

  test("cancel should wait for already started finalizers on success") { implicit sc =>

    val fa = for {
      pa <- Deferred[Task, Unit]
      fiber <- Task.unit.guarantee(pa.complete(()) >> Task.sleep(1.second)).start
      _ <- pa.get
      _ <- fiber.cancel
    } yield ()

    val f = fa.runToFuture

    sc.tick()
    assertEquals(f.value, None)

    sc.tick(1.second)
    assertEquals(f.value, Some(Success(())))
  }

  test("cancel should wait for already started finalizers on failure") { implicit sc =>
    val dummy = new RuntimeException("dummy")

    val fa = for {
      pa <- Deferred[Task, Unit]
      fiber <- Task.unit.guarantee(pa.complete(()) >> Task.sleep(1.second) >> Task.raiseError(dummy)).start
      _ <- pa.get
      _ <- fiber.cancel
    } yield ()

    val f = fa.runToFuture

    sc.tick()
    assertEquals(f.value, None)

    sc.tick(1.second)
    assertEquals(f.value, Some(Success(())))
  }

  test("cancel should wait for already started use finalizers") { implicit sc =>

    val fa = for {
      pa <- Deferred[Task, Unit]
      fibA <- Task.unit
        .bracket(
          _ => Task.unit.guarantee(pa.complete(()) >> Task.sleep(2.second))
        )(_ => Task.unit)
        .start
      _ <- pa.get
      _ <- fibA.cancel
    } yield ()

    val f = fa.runToFuture

    sc.tick()
    assertEquals(f.value, None)

    sc.tick(2.second)
    assertEquals(f.value, Some(Success(())))
  }

  test("second cancel should wait for use finalizers") { implicit sc =>

    val fa = for {
      pa <- Deferred[Task, Unit]
      fiber <- Task.unit
        .bracket(
          _ => (pa.complete(()) >> Task.never).guarantee(Task.sleep(2.second))
        )(_ => Task.unit)
        .start
      _ <- pa.get
      _ <- Task.race(fiber.cancel, fiber.cancel)
    } yield ()

    val f = fa.runToFuture

    sc.tick()
    assertEquals(f.value, None)

    sc.tick(2.second)
    assertEquals(f.value, Some(Success(())))
  }

  test("second cancel during acquire should wait for it and finalizers to complete") { implicit sc =>

    val fa = for {
      pa <- Deferred[Task, Unit]
      fiber <- (pa.complete(()) >> Task.sleep(1.second))
        .bracket(_ => Task.unit)(_ => Task.sleep(1.second))
        .start
      _ <- pa.get
      _ <- Task.race(fiber.cancel, fiber.cancel)
    } yield ()

    val f = fa.runToFuture

    sc.tick()
    assertEquals(f.value, None)

    sc.tick(1.second)
    assertEquals(f.value, None)

    sc.tick(1.second)
    assertEquals(f.value, Some(Success(())))
  }

  test("second cancel during acquire should wait for it and finalizers to complete (non-terminating)") {
    implicit sc =>

      val fa = for {
        pa <- Deferred[Task, Unit]
        fiber <- (pa.complete(()) >> Task.sleep(1.second))
          .bracket(_ => Task.unit)(_ => Task.never)
          .start
        _ <- pa.get
        _ <- Task.race(fiber.cancel, fiber.cancel)
      } yield ()

      val f = fa.runToFuture

      sc.tick()
      assertEquals(f.value, None)

      sc.tick(1.day)
      assertEquals(f.value, None)
  }

  test("Multiple cancel should not hang") { implicit sc =>

    val fa = for {
      fiber <- Task.sleep(1.second).start
      _ <- fiber.cancel
      _ <- fiber.cancel
    } yield ()

    val f = fa.runToFuture

    sc.tick()
    assertEquals(f.value, Some(Success(())))
  }

  test("bracket can be canceled while failing to acquire") { implicit sc =>

    val task = (Task.sleep(2.second) *> Task.raiseError[Unit](DummyException("BOOM")))
      .bracket(_ => Task.unit)(_ => Task.unit)

    val cancelToken = task.runAsyncF(_ => ())

    sc.tick(1.second)
    val f = cancelToken.runToFuture

    sc.tick(1.second)
    assertEquals(f.value, Some(Success(())))
  }
}