[4.1] 94a5f27 Add a debug.sleep(DURATION) synchronization helper
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Fri Sep 4 15:54:50 CEST 2015
commit 94a5f275aed3bfd1a49b486e76be31d4a64ac0c3
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Mon Jul 6 08:24:54 2015 +0200
Add a debug.sleep(DURATION) synchronization helper
diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc
index 67edd62..305deaa 100644
--- a/lib/libvmod_debug/vmod.vcc
+++ b/lib/libvmod_debug/vmod.vcc
@@ -105,3 +105,7 @@ Register the vmod to receive expiry callbacks
$Function VOID init_fail()
Function to fail vcl_init{}
+
+$Function VOID sleep(DURATION)
+
+Block the current worker thread.
diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c
index f9f3361..ce2e22b 100644
--- a/lib/libvmod_debug/vmod_debug.c
+++ b/lib/libvmod_debug/vmod_debug.c
@@ -36,6 +36,7 @@
#include "vcl.h"
#include "vrt.h"
#include "vsb.h"
+#include "vtim.h"
#include "vcc_if.h"
struct priv_vcl {
@@ -269,3 +270,11 @@ event_function(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
priv->free = priv_vcl_free;
return (0);
}
+
+VCL_VOID __match_proto__(td_debug_sleep)
+vmod_sleep(VRT_CTX, VCL_DURATION t)
+{
+
+ CHECK_OBJ_ORNULL(ctx, VRT_CTX_MAGIC);
+ VTIM_sleep(t);
+}
More information about the varnish-commit
mailing list