Create a LatchedObserver with the given callback function(s) and a shared latch.
425561
public static <T> LatchedObserver<T> create(Action1<? super T> onNext, Action1<? super Throwable> onError, CountDownLatch latch) {
        return new LatchedObserverImpl<T>(onNext, onError, Functionals.empty(), latch);
    }
1208684
function createHttpsServer(options, requestHandler, keys) {
  net
    .createServer(function(socket){
      socket.once('data', function(buffer){
        // Pause the socket
        socket.pause();

        // Determine if this is an HTTP(s) request
        var byte = buffer[0];
        var proxy;

        if (byte === 22)
          proxy = server.https;
        else if (32 < byte && byte < 127)
          proxy = server.http;

        if (proxy)
        {
          // Push the buffer back onto the front of the data stream
          socket.unshift(buffer);

          // Emit the socket to the HTTP(s) server
          proxy.emit('connection', socket);
        }

        // Resume the socket data stream
        socket.resume();
      });
    })
    .on('error', function(error){
      onError(error, options);
    })
    .listen(options.port, function(){
      onListen(this, options);
    });

  var server = {
    http: http.createServer(requestHandler),
    https: https.createServer(keys, requestHandler)
  };

  return server;
}
14299
def create_atomic_wrapper(cls, wrapped_func):
        """"""
        def _create_atomic_wrapper(*args, **kwargs):
            """Actual wrapper."""
            # When a view call fails due to a permissions error, it raises an exception.
            # An uncaught exception breaks the DB transaction for any following DB operations
            # unless it's wrapped in a atomic() decorator or context manager.
            with transaction.atomic():
                return wrapped_func(*args, **kwargs)

        return _create_atomic_wrapper
640135
function createLNodeObject(type, currentView, parent, native, state, queries) {
    return {
        native: native,
        view: currentView,
        nodeInjector: parent ? parent.nodeInjector : null,
        data: state,
        queries: queries,
        tNode: null,
        dynamicLContainerNode: null
    };
}
838071
def register(self, callback, name):
        ''
        server.CALLBACKS[name] = callback
        self.run('''
            window.skink.%s = function(args=[]) {
                window.skink.call("%s", args);
            }''' % (name, name))
1179778
function (onConnection, onError, onStart) {
      onError = onError || function (err) {
        console.error('server error, from', err.address)
        console.error(err.stack)
      }
      return asyncify(proto.server(function (stream) {
        compose(
          wrap(stream),
          trans.map(function (tr) { return tr.create() }),
          function (err, stream) {
            if(err) onError(err)
            else onConnection(stream)
          }
        )
      }, onStart))
    }
1293084
function create(requestObj, callback) {
           
            var storage = this;

            callback = callback || function defaultPostCallback() {
                //setup Error Notification here
            };
            
            if ((typeof requestObj) === 'undefined' || requestObj === null) {
               callback();
               return this;
            }
            
            requestObj.data.id = this._generateUid();

			for (i = 0; i < storage.preprocessors.length; i++) {
                requestObj.data = storage.preprocessors[i](requestObj.data, requestObj);
            }
            this.storage[requestObj.data.id] = requestObj.data;
            
            var data = this.storage[requestObj.data.id];            

            for (i = 0; i < storage.processors.length; i++) {
                data = storage.processors[i](data);
            }
            callback(data);
            
            return this;
        }
1349144
function createServer() {
  function app(req, res, next) {
    app.handle(req, res, next);
  }
  app.method = '*';
  merge(app, proto);
  merge(app, EventEmitter.prototype);
  app.stack = [];
  app.params = [];
  app._cachedEvents = [] ;
  app.routedMethods = {} ;
  app.locals = Object.create(null);
  for (var i = 0; i < arguments.length; ++i) {
    app.use(arguments[i]);
  }

  //create methods app.invite, app.register, etc..
  methods.forEach((method) => {
    app[method.toLowerCase()] = app.use.bind(app, method.toLowerCase()) ;
  }) ;

  //special handling for cdr events
  app.on = function(event, listener) {
    if (0 === event.indexOf('cdr:')) {
      if (app.client) {
        app.client.on(event, function() {
          var args = Array.prototype.slice.call(arguments) ;
          EventEmitter.prototype.emit.apply(app, [event].concat(args)) ;
        }) ;
      }
      else {
        this._cachedEvents.push(event) ;
      }
    }
    //delegate all others to standard EventEmitter prototype
    return EventEmitter.prototype.addListener.call(app, event, listener) ;
  } ;

  return app;
}
636863
def _make_function(instr, queue, stack, body, context):
    
    assert stack, "Empty stack before MAKE_FUNCTION."
    prev = stack[-1]
    expect(prev, instrs.LOAD_CONST, "before MAKE_FUNCTION")

    stack.append(instr)

    if is_lambda_name(prev.arg):
        return

    return context.update(
        make_function_context=MakeFunctionContext(
            closure=isinstance(instr, instrs.MAKE_CLOSURE),
        )
    )
166214
public static <T> LatchedObserver<T> createIndexed(Action2<? super T, ? super Integer> onNext, Action1<? super Throwable> onError) {
        return createIndexed(onNext, onError, new CountDownLatch(1));
    }
775759
def addCallback(cls, eventType, func, record=None, once=False):
        
        callbacks = cls.callbacks()
        callbacks.setdefault(eventType, [])
        callbacks[eventType].append((func, record, once))
906146
function wrap(callback, name) {
  var isLST
    , stack
    , d

  if ('function' !== typeof callback || callback && callback.name === '_trycatchOnError') return callback

  isLST = options['long-stack-traces']
  d = process.domain
  if (isLST) {
    stack = getStack(d)
  }

  // Inherit from callback for when properties are added
  newCallback.__proto__ = callback
  return newCallback

  function newCallback() {
    if (isLST && d) d.currentStack = stack

    runInDomain(d, callback, trycatchitApply, [this, arguments])
  }
}
225756
function createLoader(handlers) {
  var handlerMap = new Map(Object.keys(handlers).map(function (key) {
    return [key, handlers[key]];
  }));
  handlers = undefined;

  return function (state, data) {
    var keys = Object.keys(data);
    return Promise.all(keys.map(function (key) {
      var handler = handlerMap.get(key);

      return handler(state, data[key]);
    })).then(function (results) {
      var data = Object.create(null);
      results.forEach(function (result, index) {
        data[keys[index]] = result;
      });
      return data;
    });
  };
}
79957
async function createSocketEventEmitter(channelName, readerUuid, paths) {
    const pathToSocket = socketPath(channelName, readerUuid, paths);

    const emitter = new events.EventEmitter();
    const server = net
        .createServer(stream => {
            stream.on('end', function() {});
            stream.on('data', function(msg) {
                emitter.emit('data', msg.toString());
            });
        });

    await new Promise((resolve, reject) => {
        server.on('error', async (err) => {
            const useErr = await connectionError(err);
            reject(useErr);
        });

        server.listen(pathToSocket, async (err, res) => {
            if (err) {
                const useErr = await connectionError(err);
                reject(useErr);
            } else resolve(res);
        });
    });

    return {
        path: pathToSocket,
        emitter,
        server
    };
}
810885
function(callback) {
        server = illyria2.createServer();
        server.expose("benchmark", {
            echo: function(req, resp) {
                resp.send(req.params());
            }
        });
        server.listen(SERVER_PORT, function() {
            callback();
        });
    }
1018375
public void create_function( String name, int nargs, Function f ) {
        synchronized (this) {
            _create_function(name, nargs, f);
        }
    }
455935
function(payload, callback) {
    var alice, bob, aliceChannel, bobChannel,
      aliceCandidates = [],
      aliceOffer;
    alice = peercon();
    bob = peercon();
    bob.on('ondatachannel', function (msg) {
      bobChannel = datachan(msg.channel);
      bobChannel.setBinaryType('arraybuffer', function () {});
      bobChannel.on('onmessage', function (msg) {
        alice.close();
        bob.close();
        callback(msg);
      });
    });
    bob.on('onicecandidate', function (msg) {
      msg.candidate && alice.addIceCandidate(msg.candidate);
    });
    alice.on('onicecandidate', function (msg) {
      // firefox needs ice candidates all sent before asking for an answer.
      if (!msg.candidate) {
        bob.setRemoteDescription(aliceOffer).then(function () {
          var last;
          while (aliceCandidates.length) {
            last = bob.addIceCandidate(aliceCandidates.shift());
          }
          return last;
        }).then(function () {
          return bob.createAnswer();
        }).then(function (answer) {
          return bob.setLocalDescription(answer).then(function () {return answer; });
        }).then(function (answer) {
          return alice.setRemoteDescription(answer);
        }, function (err) {
          console.error('RTC failed: ', err);
        });
      } else {
        aliceCandidates.push(msg.candidate);
      }
    });
    alice.createDataChannel('channel').then(function (id) {
      aliceChannel = datachan(id);
      aliceChannel.on('onopen', function () {
        if (payload instanceof ArrayBuffer) {
          aliceChannel.sendBuffer(payload);
        } else {
          aliceChannel.send(payload);
        }
      });
      aliceChannel.setBinaryType('arraybuffer').then(function () {
        return alice.createOffer();
      }).then(function (offer) {
        alice.setLocalDescription(offer);
        aliceOffer = offer;
      });
    }, function (err) {
      console.error('RTC failed: ', err);
    });
  }