]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
glib-2.0: add ThreadPool.with_owned_data and ThreadPool.add
authorEvan Nemerson <evan@coeus-group.com>
Wed, 6 Jun 2012 16:33:32 +0000 (09:33 -0700)
committerEvan Nemerson <evan@coeus-group.com>
Wed, 6 Jun 2012 16:33:32 +0000 (09:33 -0700)
This allows for more intuitive use of ThreadPool.  The old bindings
are marked as deprecated but kept in place to maintain backwards
compatibility.  Fixes bug 676741.

vapi/glib-2.0.vapi

index ff1dedffa2e62fc7ab19fe5224fbe2e8b3883ea7..b5b3783535ba56be29e73c7ba23451645845eaad 100644 (file)
@@ -1783,11 +1783,20 @@ namespace GLib {
        
        /* Thread Pools */
 
+       [CCode (cname = "GFunc")]
+       public delegate void ThreadPoolFunc<G> (owned G data);
+
        [Compact]
        [CCode (free_function = "g_thread_pool_free")]
        public class ThreadPool<T> {
+               [Deprecated (since = "vala-0.18", replacement = "ThreadPool.with_owned_data")]
                public ThreadPool (Func<T> func, int max_threads, bool exclusive) throws ThreadError;
+               [CCode (cname = "g_thread_pool_new")]
+               public ThreadPool.with_owned_data (ThreadPoolFunc<T> func, int max_threads, bool exclusive) throws ThreadError;
+               [Deprecated (since = "vala-0.18", replacement = "add")]
                public void push (T data) throws ThreadError;
+               [CCode (cname = "g_thread_pool_push")]
+               public void add (owned T data) throws ThreadError;
                public void set_max_threads (int max_threads) throws ThreadError;
                public int get_max_threads ();
                public uint get_num_threads ();