Subscribe to the requested udev subsystem and apply the given action.
335057
def add_udev_trigger(self, trigger_action, subsystem):
        
        if self._py3_wrapper.udev_monitor.subscribe(self, trigger_action, subsystem):
            if trigger_action == "refresh_and_freeze":
                # FIXME: we may want to disable refresh instead of using cache_timeout
                self.module_class.cache_timeout = PY3_CACHE_FOREVER
1358810
function subscribeRaw(peripheralId, serviceUuid, uuid, state, callback) {

  //todo catch exceptions
  var peripheral = peripherals[peripheralId];
  var characteristic = servicesCache[peripheralId].services[serviceUuid].characteristics[uuid];
  var handle = characteristic.descriptors['2902'];

  if (state == false) {
    value = '0000';
  } else {
    if (characteristic.properties == 'indicate'){
      value = '0200';
    } else  {// notify
      value = '0100';
    }    
  }

  //if not connected, connect
  checkConnected(peripheral, function(){
    peripheral.writeHandle(handle, new Buffer(value, 'hex'), false, function(error){
      if (error){
        debug('Subscribe error '.red + peripheralId + ' : ' + serviceUuid + ' : ' + uuid )
      }
      sendEvent({
        type: 'notify',
        peripheralId: peripheralId,
        serviceUuid: serviceUuid,
        characteristicUuid: uuid,
        state: state
      });
    });
  })

  checkRawNotificationListeners();
}
884930
def auto_subscribe(self, app_manager):
        """"""
        for handler in app_manager.handler_classes:
            app_manager.subscribe(handler.channel(), self)
766483
function subscriber(port) {
  var socket = zeromq.socket('sub');
  socket.identity = 'sub' + process.pid;

  // have to subscribe, otherwise nothing would show up
  // subscribe to everything
  socket.subscribe('');

  var totalMessages=0;

  // receive messages
  socket.on('message', function(data) {
    //console.log(socket.identity + ': received data ' + data.toString());
    totalMessages++;
  });

  socket.connect(port); 
  console.log('connected to ' + port);

  // lets count messages recvd
  setInterval(function() {
    console.log('messages received = ' + totalMessages);
    totalMessages=0;
  }, 1000);

}
42747
def main():
    """"""
    # Parse command line args.
    _parse_args()
    LOG.info("Starting: %s", __service_id__)

    # Subscribe to state change events.
    # FIXME(BMo) This API is unfortunate as it looks like we are only
    # subscribing to sdp_state events.
    LOG.info('Subscribing to state change events (subscriber = %s)',
             __service_name__)
    sdp_state = SDPState()
    _ = sdp_state.subscribe(subscriber=__service_name__)

    # Initialise the service.
    _ = _init(sdp_state)
    LOG.info('Finished initialising!')

    # Enter a pseudo event-loop (using Sched) to monitor for state change
    # events
    # (Also random set services into a fault or alarm state if enabled)
    LOG.info('Responding to state change events ...')
    try:
        _process_state_change_events()
    except ValueError as error:
        LOG.critical('Value error: %s', str(error))
    except KeyboardInterrupt as err:
        LOG.debug('Keyboard Interrupt %s', err)
    LOG.info('Exiting!')
878471
static function subscribe($to, $status)
    {
        $xml = self::maker($to, $status, false, false, 'subscribe');
        \Moxl\API::request($xml);
    }
903904
def start (self):
        '''
        

        '''
        self.sub = rospy.Subscriber(self.topic, Odometry, self.__callback)
554410
public final void fsub(X87Register dst, X87Register src)
  {
    assert(dst.index() == 0 || src.index() == 0);
    emitX86(INST_FSUB, dst, src);
  }
74318
static <T> void subscribe(Subscriber<? super T> s, Iterator<? extends T> it) {
        if (it == null) {
            error(s, new NullPointerException("The iterator is null"));
            return;
        }

        boolean b;

        try {
            b = it.hasNext();
        } catch (Throwable e) {
            error(s, e);
            return;
        }

        if (!b) {
           complete(s);
            return;
        }

        s.onSubscribe(new IterableSubscription<T>(s, it));

    }
355074
def subscribe(self, client):
        """"""
        self.clients.append(client)
        log("Subscribed client {} to channel {}".format(client, self.name))
1215997
function subscribe(subscriber, immediate) {
        if (!~subscribers.indexOf(subscriber)) {
            subscribers.push(subscriber);
        }
        if (immediate) {
            subscriber(value);
        }
    }
1362572
def pre_change_receiver(self, instance: Model, action: Action):
        
        if action == Action.CREATE:
            group_names = set()
        else:
            group_names = set(self.group_names(instance))

        # use a thread local dict to be safe...
        if not hasattr(instance, '__instance_groups'):
            instance.__instance_groups = threading.local()
            instance.__instance_groups.observers = {}
        if not hasattr(instance.__instance_groups, 'observers'):
            instance.__instance_groups.observers = {}

        instance.__instance_groups.observers[self] = group_names
274225
def post(self, request, *args, **kwargs):
        
        return self.subscribe(request, *args, **kwargs)
531427
protected <E extends Event> Listener subscribeSystemEvent(Class<E> eventClass, final Class<? extends Listener<E>> listenerClass) {
        Listener<E> listener = locator.createAndInitialize(listenerClass);
        SystemEventBus.subscribe(eventClass, listener);
        return listener;
    }
360179
def accept_subscription(&blk)
      pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'subscribed')
      connection.send_stanza pres, &blk
    end
1224259
private void realSubscribe(Subscriber subs) {
        AtomicInteger doneCount = new AtomicInteger(shards.size());
        ChangeReceiver receiver = subs.getReceiver();
        ArrayList<Subscriber> subsList = new ArrayList();
        shards.forEach( shard -> {
            Subscriber shardSubs = new Subscriber(subs.getFilter(), change -> {
                if (change.getType() == ChangeMessage.QUERYDONE) {
                    int count = doneCount.decrementAndGet();
                    if (count == 0) {
                        receiver.receive(change);
                    }
                } else {
                    receiver.receive(change);
                }
            });
            subsList.add(shardSubs);
            shard.subscribe(shardSubs);
        });
        subsMap.put(subs,subsList);
    }
366430
def subscribe(self, handler):
        """"""
        assert callable(handler), "Invalid handler %s" % handler
        self.handlers.append(handler)