Commit 5b64de6d1042350451b0a39465441ea74eb0d708

Baptiste 2024-08-08T12:36:42

event.kc3

diff --git a/lib/kc3/0.1/http/event.kc3 b/lib/kc3/0.1/http/event.kc3
new file mode 100644
index 0000000..e460c6d
--- /dev/null
+++ b/lib/kc3/0.1/http/event.kc3
@@ -0,0 +1,13 @@
+defmodule HTTP.Event do
+
+  def add = cfn S32 "http_event_add" (Ptr, Time)
+
+  def del = cfn S32 "event_del" (Ptr)
+
+  def dispatch = cfn S32 "event_dispatch" ()
+
+  def init = cfn Ptr "event_init" ()
+
+  def set = cfn Void "http_event_set" (Ptr, S32, S16, Cfn, Tag)
+
+end
\ No newline at end of file
diff --git a/lib/kc3/0.1/httpd.kc3 b/lib/kc3/0.1/httpd.kc3
index 2021a66..78f79e3 100644
--- a/lib/kc3/0.1/httpd.kc3
+++ b/lib/kc3/0.1/httpd.kc3
@@ -5,6 +5,7 @@ defmodule HTTPd do
   require Socket.Buf
   require Str
   require HTTP
+  require HTTP.Event
   require HTTP.Request
   require HTTP.Response
   
@@ -39,6 +40,7 @@ defmodule HTTPd do
       HTTP.mime_type_load("mime.types")
       host = getenv("KC3_HTTPD_HOST")
       port = getenv("KC3_HTTPD_PORT")
+      event_base = HTTP.Event.init();
       server(host, port)
     }
     (host, port) {