createThreadSafePool
175146
@Override
    public Pool create(int minimum, int maximum, EJBPMICollaborator beanPerf, PoolDiscardStrategy d)
    {
        PoolImplBase result = new PoolImplThreadSafe(minimum, maximum, beanPerf, d, this);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "create: " + result);
        return result;
    }
1157436
def create_thread(daemon, callback, *callbackParams):
    
    task = Thread(target=callback, args=callbackParams)
    task.setDaemon(daemon)
    return task
404309
def threads_init(gtk=True):
    
    # enable X11 multithreading
    x11.XInitThreads()
    if gtk:
        from gtk.gdk import threads_init
        threads_init()
995198
def get_selected_thread(self):
        """"""
        threadlinewidget = self.get_selected_threadline()
        thread = None
        if threadlinewidget:
            thread = threadlinewidget.get_thread()
        return thread
331810
private void addThread() {
        Thread t = new WorkerThread(workQueue);
        threads.add(t);
        t.start();            
    }
363450
def default_create_thread(callback):
    
    thread = threading.Thread(None, callback)
    thread.daemon = True  # Don't let thread prevent termination
    thread.start()
    return thread
1136520
static ThreadFactory newDaemonThreadFactory(final String prefix) {
    final ThreadFactory namedFactory = getNamedThreadFactory(prefix);
    return new ThreadFactory() {
      @Override
      public Thread newThread(Runnable r) {
        Thread t = namedFactory.newThread(r);
        if (!t.isDaemon()) {
          t.setDaemon(true);
        }
        if (t.getPriority() != Thread.NORM_PRIORITY) {
          t.setPriority(Thread.NORM_PRIORITY);
        }
        return t;
      }

    };
  }
1254391
public static ThreadPoolExecutor createThreadPoolExecutor(final int queueSize, final String threadName, ThreadFactory threadFactory, final RejectedExecutionHandler policy)
   {
      if (threadFactory == null) {
         threadFactory = new DefaultThreadFactory(threadName, true);
      }

      LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<>(queueSize);
      ThreadPoolExecutor executor = new ThreadPoolExecutor(1 /*core*/, 1 /*max*/, 5 /*keepalive*/, SECONDS, queue, threadFactory, policy);
      executor.allowCoreThreadTimeOut(true);
      return executor;
   }
1003255
private void prepareThreadManager(StreamConfiguration sc) {
    assert(!flacStreamIsOpen);
    if(MAX_THREADED_FRAMES > 0) {
      threadManager = new BlockThreadManager(this);
      threadedFrames = new Frame[MAX_THREADED_FRAMES];
      for(int i = 0; i < MAX_THREADED_FRAMES; i++) {
        threadedFrames[i]  = new Frame(this.streamConfig);
        threadManager.addFrameThread(threadedFrames[i]);
      }
    }
    else {
      threadManager = null;
    }
  }
1186626
public static BundleLookupThreadContext getThreadContext(boolean createIfMissing) {
		BundleLookupThreadContext context = threadContext.get();
		if(createIfMissing && context==null) {
			context = new BundleLookupThreadContext();
			threadContext.set(context);
		}
		return context;
	}
1088670
static ExecutorService createExecutorService(final String threads) {
        final int threadCount;
        if (threads.endsWith("C")) {
            threadCount = Integer.parseInt(threads.substring(0, threads.length() - 1))
                    * Runtime.getRuntime().availableProcessors();
        } else {
            threadCount = Integer.parseInt(threads);
        }
        final ClassLoader currentThreadContextClassloader = Thread.currentThread().getContextClassLoader();
        final AtomicInteger threadIndex = new AtomicInteger(1);
        return Executors.newFixedThreadPool(
                threadCount,
                r -> {
                    final Thread thread = new Thread(r);
                    thread.setName("javassist-processor-" + threadIndex.getAndIncrement());
                    thread.setContextClassLoader(currentThreadContextClassloader);
                    return thread;
                });
    }
1020566
@Override
    protected Thread createThread(final Runnable runnable, final String name) {
        return new Thread(runnable, Thread.currentThread().getName() + "-exec");
    }
1348786
def set_thread(self, thread = None):
        
        if thread is None:
            self.__thread = None
        else:
            self.__load_Thread_class()
            if not isinstance(thread, Thread):
                msg  = "Parent thread must be a Thread instance, "
                msg += "got %s instead" % type(thread)
                raise TypeError(msg)
            self.dwThreadId = thread.get_tid()
            self.__thread = thread
681381
def setDefaultThread(self, thread_id, thread_type):
        
        self._default_thread_id = thread_id
        self._default_thread_type = thread_type
1252766
synchronized private void startFrameThreads() {
    if(!process)
      return;
    int requests = unassignedEncodeRequests.size();
    int frames = inactiveFrameThreads.size();
    frames = (requests <= frames) ? requests:frames;
    for(int i = 0; i < frames; i++) {
      FrameThread ft = inactiveFrameThreads.remove(0);
      Thread thread = new Thread(ft);
      frameThreadMap.put(ft, thread);
      thread.start();
    }
  }
119806
private void joinAllThreads() {
        Iterator iter = registeredWachdogs.values().iterator();
        while (iter.hasNext()) {
            Watchdog th = (Watchdog) iter.next();
            boolean isJoining = true;
            if (!th.isAlive() && log.isDebugEnabled()) {
                log.debug("Thread " + th + " finished");
            }
            while (th.isAlive() && isJoining) {
                try {
                    th.getThread().join();
                    isJoining = false;
                    if (log.isDebugEnabled()) {
                        log.debug("Thread " + th + " joined and finished");
                    }
                } catch (InterruptedException e) {
                }
            }
        }
    }
391693
@SuppressWarnings("unchecked")
    public static <T> ThreadLocalProxy<T> createThreadLocalProxy(Class<T> type) {
        ThreadLocalProxy<?> proxy = null;
        if (UriInfo.class.isAssignableFrom(type)) {
            proxy = new ThreadLocalUriInfo();
        } else if (HttpHeaders.class.isAssignableFrom(type)) {
            proxy = new ThreadLocalHttpHeaders();
        } else if (ProtocolHeaders.class.isAssignableFrom(type)) {
            proxy = new ThreadLocalProtocolHeaders();
        } else if (SecurityContext.class.isAssignableFrom(type)) {
            proxy = new ThreadLocalSecurityContext();
        } else if (ContextResolver.class.isAssignableFrom(type)) {
            proxy = new ThreadLocalContextResolver<Object>();
        } else if (Request.class.isAssignableFrom(type)) {
            proxy = new ThreadLocalRequest();
        } else if (Providers.class.isAssignableFrom(type)) {
            proxy = new ThreadLocalProviders();
        } else if (MessageContext.class.isAssignableFrom(type)) {
            proxy = new ThreadLocalMessageContext();
// Liberty Change for CXF Begin
        } else if (type.getName().equals(MessageContext.class.getName())) {
            MessageContextProxyClassLoader loader = new MessageContextProxyClassLoader(Proxy.class.getClassLoader(), type.getClassLoader(), ThreadLocalProxy.class.getClassLoader());
            proxy = (ThreadLocalProxy<T>) Proxy.newProxyInstance(loader,
                                                                 new Class[] { type, ThreadLocalProxy.class },
                                                                 new ProxyInvocationHandler(new ThreadLocalMessageContext()));
// Liberty Change for CXF Begin
        }

        if (proxy == null && isServletApiContext(type.getName())) {
            proxy = createThreadLocalServletApiContext(type.getName());
        }
        if (proxy == null) {
            ProxyClassLoader loader = new ProxyClassLoader(Proxy.class.getClassLoader());
            loader.addLoader(type.getClassLoader());
            loader.addLoader(ThreadLocalProxy.class.getClassLoader());
            return (ThreadLocalProxy<T>) Proxy.newProxyInstance(loader,
                                                                new Class[] { type, ThreadLocalProxy.class },
                                                                new ThreadLocalInvocationHandler<T>());
        }

        return (ThreadLocalProxy<T>) proxy;
    }