Skip to content

Instantly share code, notes, and snippets.

View victorvhpg's full-sized avatar
🎯
Focusing

Victor Hugo victorvhpg

🎯
Focusing
View GitHub Profile
@JonCole
JonCole / ThreadPool.md
Last active March 6, 2024 05:03
Intro to CLR ThreadPool Growth

ThreadPool Growth: Some Important Details

The CLR ThreadPool has two types of threads - "Worker" and "I/O Completion Port" (aka IOCP) threads.

  • Worker threads are used when for things like processing Task.Run(…) or ThreadPool.QueueUserWorkItem(…) methods. These threads are also used by various components in the CLR when work needs to happen on a background thread.
  • IOCP threads are used when asynchronous IO happens (e.g. reading from the network).

The thread pool provides new worker threads or I/O completion threads on demand (without any throttling) until it reaches the "Minimum" setting for each type of thread. By default, the minimum number of threads is set to the number of processors on a system.

Once the number of existing (busy) threads hits the "minimum" number of threads, the ThreadPool will throttle the rate at which is injects new threads to one thread per 500 milliseconds. This means that if your system gets a burst of work needing an IOCP thread, it will proces

/*!
* jQuery JavaScript Library v2.1.1pre
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
@victorvhpg
victorvhpg / teclado.js
Created April 16, 2013 02:48
captura/detecta teclas.....
!function(window, document) {
var teclado = {
teclas: {
ESQUERDA: 37,
CIMA: 38,
DIREITA: 39,
BAIXO: 40,
ESPACO: 32
},
teclasPressionadas: {},
@victorvhpg
victorvhpg / carregadorRecursos.js
Last active December 16, 2015 06:39
carregador de cache de recursos
var carregadorRecursos = function() {
var _todosRecursos = {};
return {
formatoAudioSuportado: (function() {
var suporta = {};
var audio = document.createElement("audio");
var formatos = {
ogg: 'audio/ogg; codecs="vorbis"',
wav: 'audio/wav; codecs="1"',
webma: 'audio/webm; codecs="vorbis"',
@victorvhpg
victorvhpg / Chamando_WebMethod _com_jQuery.js
Last active December 10, 2015 21:48
"Chamando WebMethod com jQuery" simples metodo para facilitar a chamada de um webmetodo usando jQuery ajax
!function ($) {
//o metodo static webMetodo retorna um objeto jqXHR (enfim o retorno do $.ajax)
$.webMetodo = function (param) {
return $.ajax({
type: "POST",
contentType: "application/json",
//aqui eh o 'payLoad' deve ser uma string no formato JSON
//para o servidor poder entender
data: JSON.stringify(param.parametros),
dataType: "json",