After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 542725 - ThreadPool is unusable
ThreadPool is unusable
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings: GLib
0.3.x
Other All
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2008-07-12 23:45 UTC by Christian Hergert
Modified: 2010-01-16 19:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A vala file that fails to compile (147 bytes, text/plain)
2009-10-05 19:59 UTC, Per Arneng
  Details
Add special case for g_thread_pool_free, which takes 3 arguments. (2.36 KB, patch)
2009-11-23 04:11 UTC, Evan Nemerson
needs-work Details | Review

Description Christian Hergert 2008-07-12 23:45:47 UTC
Please describe the problem:
The threadpool is not currently usable due to the glib-2.0.vapi. I see initially two things that need to be fixed.

1) Cannot create a thread pool because of the constructor thinking it needs a user_data argument.
2) The free method takes 3 parameters, and the generated code only passes the threadpool.

To fix the first problem, we can change the constructor to:

[CCode (instance_pos = 1)]
public ThreadPool (Func func, int max_threads, bool exclusive) throws ThreadError;

Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Christian Hergert 2008-07-13 00:22:41 UTC
So we can also just make free an instance method and require that freeing be done explicitly.

[CCode (free_function = "")]

and

public void free (bool immediate, bool wait_);
Comment 2 Jürg Billeter 2008-09-27 10:03:44 UTC
The constructor issue has been fixed in r1790, the free issue is still open.
Comment 3 Per Arneng 2009-10-05 19:59:50 UTC
Created attachment 144832 [details]
A vala file that fails to compile 

Testcase that fails compilation

$ valac --version
Vala 0.7.7

$ valac threadpooltest.vala
 ....
threadpooltest.vala.c: In function ‘_main’:
threadpooltest.vala.c:39: error: too few arguments to function ‘g_thread_pool_free’
Comment 4 Evan Nemerson 2009-11-23 04:11:09 UTC
Created attachment 148300 [details] [review]
Add special case for g_thread_pool_free, which takes 3 arguments.

I'm not sure whether this should be called as g_thread_pool (foo, FALSE, TRUE) or g_thread_pool (foo, TRUE, TRUE). I went with the former, but it's trivial to switch to the latter.

Docs are at http://library.gnome.org/devel/glib/stable/glib-Thread-Pools.html#g-thread-pool-free
Comment 5 Jürg Billeter 2010-01-16 19:30:12 UTC
Review of attachment 148300 [details] [review]:

The GObject profile `if` statement breaks array handling.
Comment 6 Jürg Billeter 2010-01-16 19:31:31 UTC
commit 8630f4be0e5dcf749a60918700718b25e135786f
Author: Jürg Billeter <j@bitron.ch>
Date:   Sat Jan 16 20:24:27 2010 +0100

    Fix freeing ThreadPool
    
    Adds special case for g_thread_pool_free, which takes 3 arguments.
    
    Based on patch by Evan Nemerson, fixes bug 542725.