Skip to content

Instantly share code, notes, and snippets.

diff --git a/test/test-tcp-write-queue-order.c b/test/test-tcp-write-queue-order.c
index c6b1808..ccc8fcc 100644
--- a/test/test-tcp-write-queue-order.c
+++ b/test/test-tcp-write-queue-order.c
@@ -26,11 +26,9 @@
#include "uv.h"
#include "task.h"
-#define FILL_COUNT 100000
-#define REST_COUNT 100
diff --git a/src/threadpool.c b/src/threadpool.c
index fd1cab5..173bbe5 100644
--- a/src/threadpool.c
+++ b/src/threadpool.c
@@ -179,6 +179,7 @@ void uv__work_submit(uv_loop_t* loop,
w->loop = loop;
w->work = work;
w->done = done;
+ QUEUE_INIT(&w->wq);
post(&w->wq);

RFC: Replace uv_sread_start/stop with uv_read

Overview

This proposal aims to replace the current functions to start and stop reading data from a stream in a push-fashion with a uv_read function which would work in a pull-fashion. Function prototype:

typedef void (*uv_read_cb)(uv_read_t* req, int status);
import socket
def is_valid_ip(ip):
r = 0
try:
socket.inet_pton(socket.AF_INET, ip)
except socket.error:
try:
socket.inet_pton(socket.AF_INET6, ip)
@saghul
saghul / gist:10970277
Created April 17, 2014 10:00
Entitlement to use POSIX semaphores on OSX with Sandboxing
<key>com.apple.security.temporary-exception.sbpl</key>
<string>
(begin
(allow ipc-posix-sem))
</string>
@saghul
saghul / gist:10200313
Created April 8, 2014 22:06
Drop all tables in a MySQL DB
# You can thank https://twitter.com/miguel2angel
mysql -N -e "SELECT CONCAT('DROP TABLE ', GROUP_CONCAT(table_name), ';') FROM information_schema.tables WHERE table_schema = 'dbName'" | mysql dbName

Keybase proof

I hereby claim:

  • I am saghul on github.
  • I am saghul (https://keybase.io/saghul) on keybase.
  • I have a public key whose fingerprint is FDF5 1936 4458 319F A823 3DC9 410E 5553 AE9B C059

To claim this, I am signing this object:

#!/usr/bin/python -u
import signal
import sys
import pyuv
pyuv.Process.disable_stdio_inheritance()
def on_signal(handle, signum):
sys.exit()
import sys
import os
REMOVE_THESE = ["-I/usr/include", "-I/usr/include/", "-L/usr/lib", "-L/usr/lib/"]
class Pkg:
def __init__(self, pkg_name):
self.name = pkg_name
self.priority = 0
self.vars = {}
diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc
index 4876422..4d6cdf3 100644
--- a/src/spawn_sync.cc
+++ b/src/spawn_sync.cc
@@ -450,9 +450,10 @@ void SyncProcessRunner::TryInitializeAndRunLoop(Local<Value> options) {
assert(lifecycle_ == kUninitialized);
lifecycle_ = kInitialized;
- uv_loop_ = uv_loop_new();
+ uv_loop_ = static_cast<uv_loop_t*>(malloc(sizeof *uv_loop_));