Domain suspend events handler
199988
def _domain_event_pmsuspend_cb(conn, domain, reason, opaque):
    '''
    
    '''
    _salt_send_domain_event(opaque, conn, domain, opaque['event'], {
        'reason': 'unknown'  # currently unused
    })
48996
def _handle(self, event_handler, event_name, user_args, event_timeout,
                cond, cond_timeout):
        
        if cond:
            cond.wait(cond_timeout)
        event = self.pop_event(event_name, event_timeout)
        return event_handler(event, *user_args)
130664
function splitAroundSuspends (currentEvent, pumpSuspends, firstResumeTime, suspendedPrior, lastSuspendTime, currentlySuspended) {
    var events = [];

    var firstResumeStarted = new Date(firstResumeTime);
    var firstResumeDate = firstResumeStarted.getTime()

    var lastSuspendStarted = new Date(lastSuspendTime);
    var lastSuspendDate = lastSuspendStarted.getTime();

    if (suspendedPrior && (currentEvent.date < firstResumeDate)) {
        if ((currentEvent.date+currentEvent.duration*60*1000) < firstResumeDate) {
            currentEvent.duration = 0;
        } else {
            currentEvent.duration = ((currentEvent.date+currentEvent.duration*60*1000)-firstResumeDate)/60/1000;

            currentEvent.started_at = new Date(tz(firstResumeTime));
            currentEvent.date = firstResumeDate
        }
    }

    if (currentlySuspended && ((currentEvent.date+currentEvent.duration*60*1000) > lastSuspendTime)) {
        if (currentEvent.date > lastSuspendTime) {
            currentEvent.duration = 0;
        } else {
            currentEvent.duration = (firstResumeDate - currentEvent.date)/60/1000;
        }
    }

    events.push(currentEvent);

    if (currentEvent.duration == 0) {
        // bail out rather than wasting time going through the rest of the suspend events
        return events;
    }

    for (var i=0; i < pumpSuspends.length; i++) {
        var suspend = pumpSuspends[i];

        for (var j=0; j < events.length; j++) {

            if ((events[j].date <= suspend.date) && (events[j].date+events[j].duration*60*1000) > suspend.date) {
                // event started before the suspend, but finished after the suspend started

                if ((events[j].date+events[j].duration*60*1000) > (suspend.date+suspend.duration*60*1000)) {
                    var event2 = _.cloneDeep(events[j]);

                    var event2StartDate = moment(suspend.started_at).add(suspend.duration,'minutes');

                    event2.timestamp = event2StartDate.format();
                    event2.started_at = new Date(tz(event2.timestamp));
                    event2.date = suspend.date+suspend.duration*60*1000;

                    event2.duration = ((events[j].date+events[j].duration*60*1000) - (suspend.date+suspend.duration*60*1000))/60/1000;

                    events.push(event2);
                }

                events[j].duration = (suspend.date-events[j].date)/60/1000;

            } else if ((suspend.date <= events[j].date) && (suspend.date+suspend.duration*60*1000 > events[j].date)) {
                // suspend started before the event, but finished after the event started
            
                events[j].duration = ((events[j].date+events[j].duration*60*1000) - (suspend.date+suspend.duration*60*1000))/60/1000;

                var eventStartDate = moment(suspend.started_at).add(suspend.duration,'minutes');

                events[j].timestamp = eventStartDate.format();
                events[j].started_at = new Date(tz(events[j].timestamp));
                events[j].date = suspend.date + suspend.duration*60*1000;
            }
        }
    }

    return events;
}
1036841
def _domain_event_io_error_cb(conn, domain, srcpath, devalias, action, reason, opaque):
    '''
    
    '''
    _salt_send_domain_event(opaque, conn, domain, opaque['event'], {
        'srcPath': srcpath,
        'dev': devalias,
        'action': _get_libvirt_enum_string('VIR_DOMAIN_EVENT_IO_ERROR_', action),
        'reason': reason
    })
840537
def _domain_event_tray_change_cb(conn, domain, dev, reason, opaque):
    '''
    
    '''
    _salt_send_domain_event(opaque, conn, domain, opaque['event'], {
        'dev': dev,
        'reason': _get_libvirt_enum_string('VIR_DOMAIN_EVENT_TRAY_CHANGE_', reason)
    })
307923
def event_handler(msg: EventMsgDict) -> Event:
    """"""
    e = create_event_from_msg(msg)
    if e.currentTarget is None:
        if e.type not in ['mount', 'unmount']:
            id = msg['currentTarget']['id']
            logger.warning('No such element: wdom_id={}'.format(id))
        return e
    e.currentTarget.on_event_pre(e)
    e.currentTarget.dispatchEvent(e)
    return e
505256
private void handleRevokedGrants(
      String nodeName, Set<ClusterNode.GrantId> grantsToRevoke) {
    for (ClusterNode.GrantId grantId: grantsToRevoke) {
      String sessionHandle = grantId.getSessionId();

      try {
        sessionManager.revokeResource(sessionHandle,
            Collections.singletonList(grantId.getRequestId()));
      } catch (InvalidSessionHandle e) {
        // ignore
        LOG.warn("Found invalid session: " + sessionHandle +
                 " while timing out node: " + nodeName);
      }
    }
  }
839103
function handlerWithChainOfResponsability( eventName, evt ) {
    const chain = this._events[ eventName ].chain;
    for ( let i = 0; i < chain.length; i++ ) {
        const responsible = chain[ i ];
        if ( responsible( evt ) === true ) return;
    }
}
651911
function callAllEventHandlers(...fns) {
  return (event, ...args) =>
    fns.some(fn => {
      if (fn) {
        fn(event, ...args)
      }
      return (
        event.preventDownshiftDefault ||
        (event.hasOwnProperty('nativeEvent') &&
          event.nativeEvent.preventDownshiftDefault)
      )
    })
}
713573
final protected function raise(DomainEvent $event) : void
    {
        $this->setStateHash($this->calculateNextStateHash($event));
        if ($event instanceof AbstractDomainEvent) {
            AbstractDomainEvent::initEvent($event, $this->getId(), $this->stateHash());
        }
        EventPublisher::instance()->post($event);
    }
969454
def suspend(self, instance_id):
        '''
        
        '''
        nt_ks = self.compute_conn
        response = nt_ks.servers.suspend(instance_id)
        return True
73588
function (xpcKey) {
    if ($bc_.pN) {
      try {
        $bc_.pN.app.suspendXPCService(xpcKey)
      } catch (e) {
        console.error(e)
      }
    }
  }
964948
private void lockEvent(EventId eventId) {
		Lockable<V> eventWrapper = sharedBuffer.getEvent(eventId);
		checkState(
			eventWrapper != null,
			"Referring to non existent event with id %s",
			eventId);
		eventWrapper.lock();
		sharedBuffer.upsertEvent(eventId, eventWrapper);
	}
712278
function(start) {
		"use strict";

		var parent = this;
		return this.triggerEvent("afterLoadPreviousDomain", function() {
			var subDomain = parent.getSubDomain(start);
			return [subDomain.shift(), subDomain.pop()];
		});
	}
645511
public void suspend()
    {
        if (tc.isEntryEnabled()) Tr.entry(tc, "suspend");

        if (tc.isEventEnabled()) Tr.event(tc, "suspending (global)");
        _suspendedUOW = _tranManager.suspend();

        if (tc.isEntryEnabled()) Tr.exit(tc, "suspend", _suspendedUOWType);
    }
664709
def _domain_event_watchdog_cb(conn, domain, action, opaque):
    '''
    
    '''
    _salt_send_domain_event(opaque, conn, domain, opaque['event'], {
        'action': _get_libvirt_enum_string('VIR_DOMAIN_EVENT_WATCHDOG_', action)
    })
329294
def _domain_event_tunable_cb(conn, domain, params, opaque):
    '''
    
    '''
    _salt_send_domain_event(opaque, conn, domain, opaque['event'], {
        'params': params
    })