Lines Matching defs:thread

112  * Creates a worker thread.
120 "Can't create thread {}: {}",
189 * Set up a thread's information.
212 * Worker thread: main event loop
217 /* Any per-thread setup can happen here; thread_init() will block until
228 // Event loop exited; cleanup before thread exits.
234 /* Every time we want to notify a thread, we send 1 byte to its
235 * notification pipe. When the thread wakes up, it tries to drain
238 * this thread up to 512 times since the last time we checked the
283 // Someone requested memcached to shut down. The listen thread should
286 LOG_INFO("Stopping listen thread (thread.cc)");
292 LOG_INFO("Stopping worker thread {}", me.index);
335 * We don't want the thread to keep on serving all of the data
359 // any connections bound to this thread we can just shut down
362 LOG_INFO("Stopping worker thread {}", me.index);
366 LOG_INFO("Waiting for {} connected clients on worker thread {}",
385 "isn't bound to a thread: {}",
388 "notify_io_complete: connection should be bound to a thread: " +
400 /* kick the thread in the butt */
406 /* Which thread we assigned a connection to most recently. */
410 * Dispatches a new connection to another thread. This is only ever called
411 * from the main thread, or because of an incoming connection.
415 auto& thread = threads[tid];
421 thread.new_conn_queue.push(std::move(item));
429 MEMCACHED_CONN_DISPATCH(sfd, (uintptr_t)thread.thread_id);
430 notify_thread(thread);
434 * Returns true if this is the thread that listens for new TCP connections.
453 * Initializes the thread subsystem, creating various worker threads.
456 * main_base Event base for main thread
471 FATAL_ERROR(EXIT_FAILURE, "Can't allocate thread descriptors");
486 for (auto& thread : threads) {
487 const std::string name = "mc:worker_" + std::to_string(thread.index);
489 worker_libevent, &thread, &thread.thread_id, name.c_str());
501 for (auto& thread : threads) {
502 notify_thread(thread);
503 cb_join_thread(thread.thread_id);
508 for (auto& thread : threads) {
509 event_base_free(thread.base);
547 void notify_thread(LIBEVENT_THREAD& thread) {
548 if (cb::net::send(thread.notify[1], "", 1, 0) != 1 &&
550 LOG_WARNING("Failed to notify thread: {}",
556 auto* thread = c->getThread();
560 std::lock_guard<std::mutex> lock(thread->pending_io.mutex);
561 result = thread->pending_io.map.emplace(c, status);