Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Binding to threads-related Glib and GDK functions

  • Loading branch information...
commit 75d3393b53f25017f1f84fabf863e9251633749c 1 parent c4e212c
@toton authored
Showing with 17 additions and 6 deletions.
  1. +7 −0 src/gdk.ml
  2. +1 −6 src/glib.ml
  3. +9 −0 src/ml_gdk.c
View
7 src/gdk.ml
@@ -788,3 +788,10 @@ module Windowing = struct
external get : unit -> [`QUARTZ | `WIN32 | `X11] = "ml_gdk_get_platform"
let platform = get ()
end
+
+module Threads = struct
+ external init : unit -> unit = "ml_gdk_threads_init"
+ external enter : unit -> unit = "ml_gdk_threads_enter"
+ external leave : unit -> unit = "ml_gdk_threads_leave"
+ external g_thread_init : unit -> unit = "ml_g_thread_init" (* defined in ml_gdk.c *)
+end
View
7 src/glib.ml
@@ -116,14 +116,9 @@ module Message = struct
Printf.kprintf (_log domain (log_level level)) fmt
end
-(*
module Thread = struct
- external init : unit -> unit = "ml_g_thread_init"
- (* Call only once! *)
- external enter : unit -> unit = "ml_gdk_threads_enter"
- external leave : unit -> unit = "ml_gdk_threads_leave"
+ external init : unit -> unit = "ml_g_thread_init" (* defined in ml_gdk.c *)
end
-*)
module Convert = struct
type error =
View
9 src/ml_gdk.c
@@ -71,6 +71,15 @@ CAMLprim value ml_gdk_init(value unit)
return Val_GType(t);
}
+CAMLprim value ml_g_thread_init(value unit)
+{
+ g_thread_init(NULL);
+ return Val_unit;
+}
+ML_0(gdk_threads_init, Unit);
+ML_0(gdk_threads_enter, Unit);
+ML_0(gdk_threads_leave, Unit);
+
#include "gdk_tags.c"
Make_OptFlags_val (GdkModifier_val)
Please sign in to comment.
Something went wrong with that request. Please try again.