mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-05 02:36:19 +01:00
Include gerror.h before it is used for some g_thread_* functions.
2000-09-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * glib.h: Include gerror.h before it is used for some g_thread_* functions. * gthread.c, gthreadpool.c, glib.h: Enable error reporting for thread creation, namly for g_thread_create, g_thread_pool_new, g_thread_pool_push and g_thread_pool_set_max_threads. * tests/thread-test.c, tests/threadpool-test.c: Adapted accordingly. * gthread-posix.c (g_thread_create_posix_impl): Use GError to report errors.
This commit is contained in:
parent
21a498b1a5
commit
64bbfbb6da
10
ChangeLog
10
ChangeLog
@ -4,6 +4,16 @@
|
|||||||
g_propagte_error to hand over local errors to the calling
|
g_propagte_error to hand over local errors to the calling
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
* glib.h: Include gerror.h before it is used for some g_thread_*
|
||||||
|
functions.
|
||||||
|
|
||||||
|
* gthread.c, gthreadpool.c, glib.h: Enable error reporting for
|
||||||
|
thread creation, namly for g_thread_create, g_thread_pool_new,
|
||||||
|
g_thread_pool_push and g_thread_pool_set_max_threads.
|
||||||
|
|
||||||
|
* tests/thread-test.c, tests/threadpool-test.c: Adapted
|
||||||
|
accordingly.
|
||||||
|
|
||||||
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -4,6 +4,16 @@
|
|||||||
g_propagte_error to hand over local errors to the calling
|
g_propagte_error to hand over local errors to the calling
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
* glib.h: Include gerror.h before it is used for some g_thread_*
|
||||||
|
functions.
|
||||||
|
|
||||||
|
* gthread.c, gthreadpool.c, glib.h: Enable error reporting for
|
||||||
|
thread creation, namly for g_thread_create, g_thread_pool_new,
|
||||||
|
g_thread_pool_push and g_thread_pool_set_max_threads.
|
||||||
|
|
||||||
|
* tests/thread-test.c, tests/threadpool-test.c: Adapted
|
||||||
|
accordingly.
|
||||||
|
|
||||||
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -4,6 +4,16 @@
|
|||||||
g_propagte_error to hand over local errors to the calling
|
g_propagte_error to hand over local errors to the calling
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
* glib.h: Include gerror.h before it is used for some g_thread_*
|
||||||
|
functions.
|
||||||
|
|
||||||
|
* gthread.c, gthreadpool.c, glib.h: Enable error reporting for
|
||||||
|
thread creation, namly for g_thread_create, g_thread_pool_new,
|
||||||
|
g_thread_pool_push and g_thread_pool_set_max_threads.
|
||||||
|
|
||||||
|
* tests/thread-test.c, tests/threadpool-test.c: Adapted
|
||||||
|
accordingly.
|
||||||
|
|
||||||
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -4,6 +4,16 @@
|
|||||||
g_propagte_error to hand over local errors to the calling
|
g_propagte_error to hand over local errors to the calling
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
* glib.h: Include gerror.h before it is used for some g_thread_*
|
||||||
|
functions.
|
||||||
|
|
||||||
|
* gthread.c, gthreadpool.c, glib.h: Enable error reporting for
|
||||||
|
thread creation, namly for g_thread_create, g_thread_pool_new,
|
||||||
|
g_thread_pool_push and g_thread_pool_set_max_threads.
|
||||||
|
|
||||||
|
* tests/thread-test.c, tests/threadpool-test.c: Adapted
|
||||||
|
accordingly.
|
||||||
|
|
||||||
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -4,6 +4,16 @@
|
|||||||
g_propagte_error to hand over local errors to the calling
|
g_propagte_error to hand over local errors to the calling
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
* glib.h: Include gerror.h before it is used for some g_thread_*
|
||||||
|
functions.
|
||||||
|
|
||||||
|
* gthread.c, gthreadpool.c, glib.h: Enable error reporting for
|
||||||
|
thread creation, namly for g_thread_create, g_thread_pool_new,
|
||||||
|
g_thread_pool_push and g_thread_pool_set_max_threads.
|
||||||
|
|
||||||
|
* tests/thread-test.c, tests/threadpool-test.c: Adapted
|
||||||
|
accordingly.
|
||||||
|
|
||||||
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -4,6 +4,16 @@
|
|||||||
g_propagte_error to hand over local errors to the calling
|
g_propagte_error to hand over local errors to the calling
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
* glib.h: Include gerror.h before it is used for some g_thread_*
|
||||||
|
functions.
|
||||||
|
|
||||||
|
* gthread.c, gthreadpool.c, glib.h: Enable error reporting for
|
||||||
|
thread creation, namly for g_thread_create, g_thread_pool_new,
|
||||||
|
g_thread_pool_push and g_thread_pool_set_max_threads.
|
||||||
|
|
||||||
|
* tests/thread-test.c, tests/threadpool-test.c: Adapted
|
||||||
|
accordingly.
|
||||||
|
|
||||||
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -4,6 +4,16 @@
|
|||||||
g_propagte_error to hand over local errors to the calling
|
g_propagte_error to hand over local errors to the calling
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
* glib.h: Include gerror.h before it is used for some g_thread_*
|
||||||
|
functions.
|
||||||
|
|
||||||
|
* gthread.c, gthreadpool.c, glib.h: Enable error reporting for
|
||||||
|
thread creation, namly for g_thread_create, g_thread_pool_new,
|
||||||
|
g_thread_pool_push and g_thread_pool_set_max_threads.
|
||||||
|
|
||||||
|
* tests/thread-test.c, tests/threadpool-test.c: Adapted
|
||||||
|
accordingly.
|
||||||
|
|
||||||
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
@ -4,6 +4,16 @@
|
|||||||
g_propagte_error to hand over local errors to the calling
|
g_propagte_error to hand over local errors to the calling
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
* glib.h: Include gerror.h before it is used for some g_thread_*
|
||||||
|
functions.
|
||||||
|
|
||||||
|
* gthread.c, gthreadpool.c, glib.h: Enable error reporting for
|
||||||
|
thread creation, namly for g_thread_create, g_thread_pool_new,
|
||||||
|
g_thread_pool_push and g_thread_pool_set_max_threads.
|
||||||
|
|
||||||
|
* tests/thread-test.c, tests/threadpool-test.c: Adapted
|
||||||
|
accordingly.
|
||||||
|
|
||||||
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
2000-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* glib.h
|
* glib.h
|
||||||
|
39
glib.h
39
glib.h
@ -941,6 +941,15 @@ struct _GTuples
|
|||||||
guint len;
|
guint len;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#include <gerror.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
/* IEEE Standard 754 Single Precision Storage Format (gfloat):
|
/* IEEE Standard 754 Single Precision Storage Format (gfloat):
|
||||||
*
|
*
|
||||||
@ -3047,6 +3056,14 @@ gchar * g_win32_error_message (gint error);
|
|||||||
/* GLib Thread support
|
/* GLib Thread support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
extern GQuark g_thread_error_quark();
|
||||||
|
#define G_THREAD_ERROR g_thread_error_quark()
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
G_THREAD_ERROR_AGAIN /* Resource temporarily unavailable */
|
||||||
|
} GThreadError;
|
||||||
|
|
||||||
typedef void (*GThreadFunc) (gpointer value);
|
typedef void (*GThreadFunc) (gpointer value);
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@ -3099,7 +3116,8 @@ struct _GThreadFunctions
|
|||||||
gboolean joinable,
|
gboolean joinable,
|
||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority,
|
GThreadPriority priority,
|
||||||
gpointer thread);
|
gpointer thread,
|
||||||
|
GError **error);
|
||||||
void (*thread_yield) (void);
|
void (*thread_yield) (void);
|
||||||
void (*thread_join) (gpointer thread);
|
void (*thread_join) (gpointer thread);
|
||||||
void (*thread_exit) (void);
|
void (*thread_exit) (void);
|
||||||
@ -3161,11 +3179,12 @@ GThread* g_thread_create (GThreadFunc thread_func,
|
|||||||
gulong stack_size,
|
gulong stack_size,
|
||||||
gboolean joinable,
|
gboolean joinable,
|
||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority);
|
GThreadPriority priority,
|
||||||
|
GError **error);
|
||||||
GThread* g_thread_self ();
|
GThread* g_thread_self ();
|
||||||
void g_thread_join (GThread* thread);
|
void g_thread_join (GThread *thread);
|
||||||
void g_thread_set_priority (GThread* thread,
|
void g_thread_set_priority (GThread *thread,
|
||||||
GThreadPriority priority);
|
GThreadPriority priority);
|
||||||
|
|
||||||
/* GStaticMutexes can be statically initialized with the value
|
/* GStaticMutexes can be statically initialized with the value
|
||||||
* G_STATIC_MUTEX_INIT, and then they can directly be used, that is
|
* G_STATIC_MUTEX_INIT, and then they can directly be used, that is
|
||||||
@ -3365,20 +3384,23 @@ GThreadPool* g_thread_pool_new (GFunc thread_func,
|
|||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority,
|
GThreadPriority priority,
|
||||||
gboolean exclusive,
|
gboolean exclusive,
|
||||||
gpointer user_data);
|
gpointer user_data,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
/* Push new data into the thread pool. This task is assigned to a thread later
|
/* Push new data into the thread pool. This task is assigned to a thread later
|
||||||
* (when the maximal number of threads is reached for that pool) or now
|
* (when the maximal number of threads is reached for that pool) or now
|
||||||
* (otherwise). If necessary a new thread will be started. The function
|
* (otherwise). If necessary a new thread will be started. The function
|
||||||
* returns immediatly */
|
* returns immediatly */
|
||||||
void g_thread_pool_push (GThreadPool *pool,
|
void g_thread_pool_push (GThreadPool *pool,
|
||||||
gpointer data);
|
gpointer data,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
/* Set the number of threads, which can run concurrently for that pool, -1
|
/* Set the number of threads, which can run concurrently for that pool, -1
|
||||||
* means no limit. 0 means has the effect, that the pool won't process
|
* means no limit. 0 means has the effect, that the pool won't process
|
||||||
* requests until the limit is set higher again */
|
* requests until the limit is set higher again */
|
||||||
void g_thread_pool_set_max_threads (GThreadPool *pool,
|
void g_thread_pool_set_max_threads (GThreadPool *pool,
|
||||||
gint max_threads);
|
gint max_threads,
|
||||||
|
GError **error);
|
||||||
gint g_thread_pool_get_max_threads (GThreadPool *pool);
|
gint g_thread_pool_get_max_threads (GThreadPool *pool);
|
||||||
|
|
||||||
/* Get the number of threads assigned to that pool. This number doesn't
|
/* Get the number of threads assigned to that pool. This number doesn't
|
||||||
@ -3410,6 +3432,5 @@ void g_thread_pool_stop_unused_threads (void);
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#include <gunicode.h>
|
#include <gunicode.h>
|
||||||
#include <gerror.h>
|
|
||||||
|
|
||||||
#endif /* __G_LIB_H__ */
|
#endif /* __G_LIB_H__ */
|
||||||
|
39
glib/glib.h
39
glib/glib.h
@ -941,6 +941,15 @@ struct _GTuples
|
|||||||
guint len;
|
guint len;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#include <gerror.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
/* IEEE Standard 754 Single Precision Storage Format (gfloat):
|
/* IEEE Standard 754 Single Precision Storage Format (gfloat):
|
||||||
*
|
*
|
||||||
@ -3047,6 +3056,14 @@ gchar * g_win32_error_message (gint error);
|
|||||||
/* GLib Thread support
|
/* GLib Thread support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
extern GQuark g_thread_error_quark();
|
||||||
|
#define G_THREAD_ERROR g_thread_error_quark()
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
G_THREAD_ERROR_AGAIN /* Resource temporarily unavailable */
|
||||||
|
} GThreadError;
|
||||||
|
|
||||||
typedef void (*GThreadFunc) (gpointer value);
|
typedef void (*GThreadFunc) (gpointer value);
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@ -3099,7 +3116,8 @@ struct _GThreadFunctions
|
|||||||
gboolean joinable,
|
gboolean joinable,
|
||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority,
|
GThreadPriority priority,
|
||||||
gpointer thread);
|
gpointer thread,
|
||||||
|
GError **error);
|
||||||
void (*thread_yield) (void);
|
void (*thread_yield) (void);
|
||||||
void (*thread_join) (gpointer thread);
|
void (*thread_join) (gpointer thread);
|
||||||
void (*thread_exit) (void);
|
void (*thread_exit) (void);
|
||||||
@ -3161,11 +3179,12 @@ GThread* g_thread_create (GThreadFunc thread_func,
|
|||||||
gulong stack_size,
|
gulong stack_size,
|
||||||
gboolean joinable,
|
gboolean joinable,
|
||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority);
|
GThreadPriority priority,
|
||||||
|
GError **error);
|
||||||
GThread* g_thread_self ();
|
GThread* g_thread_self ();
|
||||||
void g_thread_join (GThread* thread);
|
void g_thread_join (GThread *thread);
|
||||||
void g_thread_set_priority (GThread* thread,
|
void g_thread_set_priority (GThread *thread,
|
||||||
GThreadPriority priority);
|
GThreadPriority priority);
|
||||||
|
|
||||||
/* GStaticMutexes can be statically initialized with the value
|
/* GStaticMutexes can be statically initialized with the value
|
||||||
* G_STATIC_MUTEX_INIT, and then they can directly be used, that is
|
* G_STATIC_MUTEX_INIT, and then they can directly be used, that is
|
||||||
@ -3365,20 +3384,23 @@ GThreadPool* g_thread_pool_new (GFunc thread_func,
|
|||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority,
|
GThreadPriority priority,
|
||||||
gboolean exclusive,
|
gboolean exclusive,
|
||||||
gpointer user_data);
|
gpointer user_data,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
/* Push new data into the thread pool. This task is assigned to a thread later
|
/* Push new data into the thread pool. This task is assigned to a thread later
|
||||||
* (when the maximal number of threads is reached for that pool) or now
|
* (when the maximal number of threads is reached for that pool) or now
|
||||||
* (otherwise). If necessary a new thread will be started. The function
|
* (otherwise). If necessary a new thread will be started. The function
|
||||||
* returns immediatly */
|
* returns immediatly */
|
||||||
void g_thread_pool_push (GThreadPool *pool,
|
void g_thread_pool_push (GThreadPool *pool,
|
||||||
gpointer data);
|
gpointer data,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
/* Set the number of threads, which can run concurrently for that pool, -1
|
/* Set the number of threads, which can run concurrently for that pool, -1
|
||||||
* means no limit. 0 means has the effect, that the pool won't process
|
* means no limit. 0 means has the effect, that the pool won't process
|
||||||
* requests until the limit is set higher again */
|
* requests until the limit is set higher again */
|
||||||
void g_thread_pool_set_max_threads (GThreadPool *pool,
|
void g_thread_pool_set_max_threads (GThreadPool *pool,
|
||||||
gint max_threads);
|
gint max_threads,
|
||||||
|
GError **error);
|
||||||
gint g_thread_pool_get_max_threads (GThreadPool *pool);
|
gint g_thread_pool_get_max_threads (GThreadPool *pool);
|
||||||
|
|
||||||
/* Get the number of threads assigned to that pool. This number doesn't
|
/* Get the number of threads assigned to that pool. This number doesn't
|
||||||
@ -3410,6 +3432,5 @@ void g_thread_pool_stop_unused_threads (void);
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#include <gunicode.h>
|
#include <gunicode.h>
|
||||||
#include <gerror.h>
|
|
||||||
|
|
||||||
#endif /* __G_LIB_H__ */
|
#endif /* __G_LIB_H__ */
|
||||||
|
@ -51,6 +51,21 @@
|
|||||||
(memcpy (&dest, &src, GLIB_SIZEOF_SYSTEM_THREAD))
|
(memcpy (&dest, &src, GLIB_SIZEOF_SYSTEM_THREAD))
|
||||||
#endif /* GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P */
|
#endif /* GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P */
|
||||||
|
|
||||||
|
GQuark
|
||||||
|
g_thread_error_quark()
|
||||||
|
{
|
||||||
|
static GQuark quark;
|
||||||
|
G_LOCK_DEFINE_STATIC(lock);
|
||||||
|
if (!quark)
|
||||||
|
{
|
||||||
|
G_LOCK (lock);
|
||||||
|
if (!quark)
|
||||||
|
quark = g_quark_from_static_string ("g-thread-error");
|
||||||
|
G_UNLOCK (lock);
|
||||||
|
}
|
||||||
|
return quark;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct _GRealThread GRealThread;
|
typedef struct _GRealThread GRealThread;
|
||||||
struct _GRealThread
|
struct _GRealThread
|
||||||
{
|
{
|
||||||
@ -97,7 +112,7 @@ GThreadFunctions g_thread_functions_for_glib_use = {
|
|||||||
NULL, /* private_set */
|
NULL, /* private_set */
|
||||||
(void(*)(GThreadFunc, gpointer, gulong,
|
(void(*)(GThreadFunc, gpointer, gulong,
|
||||||
gboolean, gboolean, GThreadPriority,
|
gboolean, gboolean, GThreadPriority,
|
||||||
gpointer))g_thread_fail, /* thread_create */
|
gpointer, GError**))g_thread_fail, /* thread_create */
|
||||||
NULL, /* thread_yield */
|
NULL, /* thread_yield */
|
||||||
NULL, /* thread_join */
|
NULL, /* thread_join */
|
||||||
NULL, /* thread_exit */
|
NULL, /* thread_exit */
|
||||||
@ -381,10 +396,11 @@ g_thread_create (GThreadFunc thread_func,
|
|||||||
gulong stack_size,
|
gulong stack_size,
|
||||||
gboolean joinable,
|
gboolean joinable,
|
||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority)
|
GThreadPriority priority,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
GRealThread* result = g_new (GRealThread, 1);
|
GRealThread* result = g_new (GRealThread, 1);
|
||||||
|
GError *local_error = NULL;
|
||||||
g_return_val_if_fail (thread_func, NULL);
|
g_return_val_if_fail (thread_func, NULL);
|
||||||
|
|
||||||
result->thread.joinable = joinable;
|
result->thread.joinable = joinable;
|
||||||
@ -394,10 +410,18 @@ g_thread_create (GThreadFunc thread_func,
|
|||||||
result->arg = arg;
|
result->arg = arg;
|
||||||
result->private_data = NULL;
|
result->private_data = NULL;
|
||||||
G_LOCK (g_thread_create);
|
G_LOCK (g_thread_create);
|
||||||
G_THREAD_UF (thread_create, (g_thread_create_proxy, result, stack_size,
|
G_THREAD_UF (thread_create, (g_thread_create_proxy, result,
|
||||||
joinable, bound, priority,
|
stack_size, joinable, bound, priority,
|
||||||
&result->system_thread));
|
&result->system_thread, &local_error));
|
||||||
G_UNLOCK (g_thread_create);
|
G_UNLOCK (g_thread_create);
|
||||||
|
|
||||||
|
if (local_error)
|
||||||
|
{
|
||||||
|
g_propagate_error (error, local_error);
|
||||||
|
g_free (result);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return (GThread*) result;
|
return (GThread*) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ static GCond *inform_cond = NULL;
|
|||||||
|
|
||||||
static void g_thread_pool_free_internal (GRealThreadPool* pool);
|
static void g_thread_pool_free_internal (GRealThreadPool* pool);
|
||||||
static void g_thread_pool_thread_proxy (gpointer data);
|
static void g_thread_pool_thread_proxy (gpointer data);
|
||||||
static void g_thread_pool_start_thread (GRealThreadPool* pool);
|
static void g_thread_pool_start_thread (GRealThreadPool* pool, GError **error);
|
||||||
static void g_thread_pool_wakeup_and_stop_all (GRealThreadPool* pool);
|
static void g_thread_pool_wakeup_and_stop_all (GRealThreadPool* pool);
|
||||||
|
|
||||||
#define g_thread_should_run(pool, len) \
|
#define g_thread_should_run(pool, len) \
|
||||||
@ -162,7 +162,8 @@ g_thread_pool_thread_proxy (gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_thread_pool_start_thread (GRealThreadPool* pool)
|
g_thread_pool_start_thread (GRealThreadPool *pool,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
GThreadPriority priority = pool->pool.priority;
|
GThreadPriority priority = pool->pool.priority;
|
||||||
@ -206,9 +207,19 @@ g_thread_pool_start_thread (GRealThreadPool* pool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
/* No thread was found, we have to start one new */
|
{
|
||||||
g_thread_create (g_thread_pool_thread_proxy, pool, pool->pool.stack_size,
|
GError *local_error = NULL;
|
||||||
FALSE, pool->pool.bound, priority);
|
/* No thread was found, we have to start one new */
|
||||||
|
g_thread_create (g_thread_pool_thread_proxy, pool,
|
||||||
|
pool->pool.stack_size, FALSE,
|
||||||
|
pool->pool.bound, priority, &local_error);
|
||||||
|
|
||||||
|
if (local_error)
|
||||||
|
{
|
||||||
|
g_propagate_error (error, local_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* See comment in g_thread_pool_thread_proxy as to why this is done
|
/* See comment in g_thread_pool_thread_proxy as to why this is done
|
||||||
* here and not there */
|
* here and not there */
|
||||||
@ -222,7 +233,8 @@ g_thread_pool_new (GFunc thread_func,
|
|||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority,
|
GThreadPriority priority,
|
||||||
gboolean exclusive,
|
gboolean exclusive,
|
||||||
gpointer user_data)
|
gpointer user_data,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
GRealThreadPool *retval;
|
GRealThreadPool *retval;
|
||||||
|
|
||||||
@ -257,9 +269,17 @@ g_thread_pool_new (GFunc thread_func,
|
|||||||
if (retval->pool.exclusive)
|
if (retval->pool.exclusive)
|
||||||
{
|
{
|
||||||
g_async_queue_lock (retval->queue);
|
g_async_queue_lock (retval->queue);
|
||||||
|
|
||||||
while (retval->num_threads < retval->max_threads)
|
while (retval->num_threads < retval->max_threads)
|
||||||
g_thread_pool_start_thread (retval);
|
{
|
||||||
|
GError *local_error = NULL;
|
||||||
|
g_thread_pool_start_thread (retval, &local_error);
|
||||||
|
if (local_error)
|
||||||
|
{
|
||||||
|
g_propagate_error (error, local_error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_async_queue_unlock (retval->queue);
|
g_async_queue_unlock (retval->queue);
|
||||||
}
|
}
|
||||||
@ -269,7 +289,8 @@ g_thread_pool_new (GFunc thread_func,
|
|||||||
|
|
||||||
void
|
void
|
||||||
g_thread_pool_push (GThreadPool *pool,
|
g_thread_pool_push (GThreadPool *pool,
|
||||||
gpointer data)
|
gpointer data,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
GRealThreadPool *real = (GRealThreadPool*) pool;
|
GRealThreadPool *real = (GRealThreadPool*) pool;
|
||||||
|
|
||||||
@ -284,17 +305,17 @@ g_thread_pool_push (GThreadPool *pool,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!pool->exclusive && g_async_queue_length_unlocked (real->queue) >= 0)
|
if (!pool->exclusive && g_async_queue_length_unlocked (real->queue) >= 0)
|
||||||
{
|
/* No thread is waiting in the queue */
|
||||||
/* No thread is waiting in the queue */
|
g_thread_pool_start_thread (real, error);
|
||||||
g_thread_pool_start_thread (real);
|
|
||||||
}
|
|
||||||
g_async_queue_push_unlocked (real->queue, data);
|
g_async_queue_push_unlocked (real->queue, data);
|
||||||
g_async_queue_unlock (real->queue);
|
g_async_queue_unlock (real->queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
g_thread_pool_set_max_threads (GThreadPool *pool,
|
g_thread_pool_set_max_threads (GThreadPool *pool,
|
||||||
gint max_threads)
|
gint max_threads,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
GRealThreadPool *real = (GRealThreadPool*) pool;
|
GRealThreadPool *real = (GRealThreadPool*) pool;
|
||||||
gint to_start;
|
gint to_start;
|
||||||
@ -314,8 +335,16 @@ g_thread_pool_set_max_threads (GThreadPool *pool,
|
|||||||
to_start = g_async_queue_length_unlocked (real->queue);
|
to_start = g_async_queue_length_unlocked (real->queue);
|
||||||
|
|
||||||
for ( ; to_start > 0; to_start--)
|
for ( ; to_start > 0; to_start--)
|
||||||
g_thread_pool_start_thread (real);
|
{
|
||||||
|
GError *local_error = NULL;
|
||||||
|
g_thread_pool_start_thread (real, &local_error);
|
||||||
|
if (local_error)
|
||||||
|
{
|
||||||
|
g_propagate_error (error, local_error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_async_queue_unlock (real->queue);
|
g_async_queue_unlock (real->queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
36
gthread.c
36
gthread.c
@ -51,6 +51,21 @@
|
|||||||
(memcpy (&dest, &src, GLIB_SIZEOF_SYSTEM_THREAD))
|
(memcpy (&dest, &src, GLIB_SIZEOF_SYSTEM_THREAD))
|
||||||
#endif /* GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P */
|
#endif /* GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P */
|
||||||
|
|
||||||
|
GQuark
|
||||||
|
g_thread_error_quark()
|
||||||
|
{
|
||||||
|
static GQuark quark;
|
||||||
|
G_LOCK_DEFINE_STATIC(lock);
|
||||||
|
if (!quark)
|
||||||
|
{
|
||||||
|
G_LOCK (lock);
|
||||||
|
if (!quark)
|
||||||
|
quark = g_quark_from_static_string ("g-thread-error");
|
||||||
|
G_UNLOCK (lock);
|
||||||
|
}
|
||||||
|
return quark;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct _GRealThread GRealThread;
|
typedef struct _GRealThread GRealThread;
|
||||||
struct _GRealThread
|
struct _GRealThread
|
||||||
{
|
{
|
||||||
@ -97,7 +112,7 @@ GThreadFunctions g_thread_functions_for_glib_use = {
|
|||||||
NULL, /* private_set */
|
NULL, /* private_set */
|
||||||
(void(*)(GThreadFunc, gpointer, gulong,
|
(void(*)(GThreadFunc, gpointer, gulong,
|
||||||
gboolean, gboolean, GThreadPriority,
|
gboolean, gboolean, GThreadPriority,
|
||||||
gpointer))g_thread_fail, /* thread_create */
|
gpointer, GError**))g_thread_fail, /* thread_create */
|
||||||
NULL, /* thread_yield */
|
NULL, /* thread_yield */
|
||||||
NULL, /* thread_join */
|
NULL, /* thread_join */
|
||||||
NULL, /* thread_exit */
|
NULL, /* thread_exit */
|
||||||
@ -381,10 +396,11 @@ g_thread_create (GThreadFunc thread_func,
|
|||||||
gulong stack_size,
|
gulong stack_size,
|
||||||
gboolean joinable,
|
gboolean joinable,
|
||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority)
|
GThreadPriority priority,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
GRealThread* result = g_new (GRealThread, 1);
|
GRealThread* result = g_new (GRealThread, 1);
|
||||||
|
GError *local_error = NULL;
|
||||||
g_return_val_if_fail (thread_func, NULL);
|
g_return_val_if_fail (thread_func, NULL);
|
||||||
|
|
||||||
result->thread.joinable = joinable;
|
result->thread.joinable = joinable;
|
||||||
@ -394,10 +410,18 @@ g_thread_create (GThreadFunc thread_func,
|
|||||||
result->arg = arg;
|
result->arg = arg;
|
||||||
result->private_data = NULL;
|
result->private_data = NULL;
|
||||||
G_LOCK (g_thread_create);
|
G_LOCK (g_thread_create);
|
||||||
G_THREAD_UF (thread_create, (g_thread_create_proxy, result, stack_size,
|
G_THREAD_UF (thread_create, (g_thread_create_proxy, result,
|
||||||
joinable, bound, priority,
|
stack_size, joinable, bound, priority,
|
||||||
&result->system_thread));
|
&result->system_thread, &local_error));
|
||||||
G_UNLOCK (g_thread_create);
|
G_UNLOCK (g_thread_create);
|
||||||
|
|
||||||
|
if (local_error)
|
||||||
|
{
|
||||||
|
g_propagate_error (error, local_error);
|
||||||
|
g_free (result);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return (GThread*) result;
|
return (GThread*) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-09-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gthread-posix.c (g_thread_create_posix_impl): Use GError to
|
||||||
|
report errors.
|
||||||
|
|
||||||
2000-05-13 Tor Lillqvist <tml@iki.fi>
|
2000-05-13 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* makefile.mingw.in: New file, with gthread stuff moved from
|
* makefile.mingw.in: New file, with gthread stuff moved from
|
||||||
|
@ -232,9 +232,11 @@ g_thread_create_posix_impl (GThreadFunc thread_func,
|
|||||||
gboolean joinable,
|
gboolean joinable,
|
||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority,
|
GThreadPriority priority,
|
||||||
gpointer thread)
|
gpointer thread,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
|
gint ret;
|
||||||
|
|
||||||
g_return_if_fail (thread_func);
|
g_return_if_fail (thread_func);
|
||||||
|
|
||||||
@ -274,12 +276,24 @@ g_thread_create_posix_impl (GThreadFunc thread_func,
|
|||||||
# endif /* G_THREADS_IMPL_DCE */
|
# endif /* G_THREADS_IMPL_DCE */
|
||||||
#endif /* HAVE_PRIORITIES */
|
#endif /* HAVE_PRIORITIES */
|
||||||
|
|
||||||
posix_check_for_error (pthread_create (thread, &attr,
|
ret = pthread_create (thread, &attr, (void* (*)(void*))thread_func, arg);
|
||||||
(void* (*)(void*))thread_func,
|
|
||||||
arg));
|
|
||||||
|
|
||||||
|
#ifdef G_THREADS_IMPL_DCE
|
||||||
|
if (ret == -1)
|
||||||
|
ret = errno;
|
||||||
|
else
|
||||||
|
ret = 0;
|
||||||
|
#endif /* G_THREADS_IMPL_DCE */
|
||||||
|
|
||||||
posix_check_for_error (pthread_attr_destroy (&attr));
|
posix_check_for_error (pthread_attr_destroy (&attr));
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
g_set_error (error, G_THREAD_ERROR, G_THREAD_ERROR_AGAIN,
|
||||||
|
"Error creating thread: %s", g_strerror (ret));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef G_THREADS_IMPL_DCE
|
#ifdef G_THREADS_IMPL_DCE
|
||||||
if (!joinable)
|
if (!joinable)
|
||||||
posix_check_for_error (pthread_detach (thread));
|
posix_check_for_error (pthread_detach (thread));
|
||||||
|
@ -55,7 +55,7 @@ static GCond *inform_cond = NULL;
|
|||||||
|
|
||||||
static void g_thread_pool_free_internal (GRealThreadPool* pool);
|
static void g_thread_pool_free_internal (GRealThreadPool* pool);
|
||||||
static void g_thread_pool_thread_proxy (gpointer data);
|
static void g_thread_pool_thread_proxy (gpointer data);
|
||||||
static void g_thread_pool_start_thread (GRealThreadPool* pool);
|
static void g_thread_pool_start_thread (GRealThreadPool* pool, GError **error);
|
||||||
static void g_thread_pool_wakeup_and_stop_all (GRealThreadPool* pool);
|
static void g_thread_pool_wakeup_and_stop_all (GRealThreadPool* pool);
|
||||||
|
|
||||||
#define g_thread_should_run(pool, len) \
|
#define g_thread_should_run(pool, len) \
|
||||||
@ -162,7 +162,8 @@ g_thread_pool_thread_proxy (gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_thread_pool_start_thread (GRealThreadPool* pool)
|
g_thread_pool_start_thread (GRealThreadPool *pool,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
GThreadPriority priority = pool->pool.priority;
|
GThreadPriority priority = pool->pool.priority;
|
||||||
@ -206,9 +207,19 @@ g_thread_pool_start_thread (GRealThreadPool* pool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
/* No thread was found, we have to start one new */
|
{
|
||||||
g_thread_create (g_thread_pool_thread_proxy, pool, pool->pool.stack_size,
|
GError *local_error = NULL;
|
||||||
FALSE, pool->pool.bound, priority);
|
/* No thread was found, we have to start one new */
|
||||||
|
g_thread_create (g_thread_pool_thread_proxy, pool,
|
||||||
|
pool->pool.stack_size, FALSE,
|
||||||
|
pool->pool.bound, priority, &local_error);
|
||||||
|
|
||||||
|
if (local_error)
|
||||||
|
{
|
||||||
|
g_propagate_error (error, local_error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* See comment in g_thread_pool_thread_proxy as to why this is done
|
/* See comment in g_thread_pool_thread_proxy as to why this is done
|
||||||
* here and not there */
|
* here and not there */
|
||||||
@ -222,7 +233,8 @@ g_thread_pool_new (GFunc thread_func,
|
|||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority,
|
GThreadPriority priority,
|
||||||
gboolean exclusive,
|
gboolean exclusive,
|
||||||
gpointer user_data)
|
gpointer user_data,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
GRealThreadPool *retval;
|
GRealThreadPool *retval;
|
||||||
|
|
||||||
@ -257,9 +269,17 @@ g_thread_pool_new (GFunc thread_func,
|
|||||||
if (retval->pool.exclusive)
|
if (retval->pool.exclusive)
|
||||||
{
|
{
|
||||||
g_async_queue_lock (retval->queue);
|
g_async_queue_lock (retval->queue);
|
||||||
|
|
||||||
while (retval->num_threads < retval->max_threads)
|
while (retval->num_threads < retval->max_threads)
|
||||||
g_thread_pool_start_thread (retval);
|
{
|
||||||
|
GError *local_error = NULL;
|
||||||
|
g_thread_pool_start_thread (retval, &local_error);
|
||||||
|
if (local_error)
|
||||||
|
{
|
||||||
|
g_propagate_error (error, local_error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_async_queue_unlock (retval->queue);
|
g_async_queue_unlock (retval->queue);
|
||||||
}
|
}
|
||||||
@ -269,7 +289,8 @@ g_thread_pool_new (GFunc thread_func,
|
|||||||
|
|
||||||
void
|
void
|
||||||
g_thread_pool_push (GThreadPool *pool,
|
g_thread_pool_push (GThreadPool *pool,
|
||||||
gpointer data)
|
gpointer data,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
GRealThreadPool *real = (GRealThreadPool*) pool;
|
GRealThreadPool *real = (GRealThreadPool*) pool;
|
||||||
|
|
||||||
@ -284,17 +305,17 @@ g_thread_pool_push (GThreadPool *pool,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!pool->exclusive && g_async_queue_length_unlocked (real->queue) >= 0)
|
if (!pool->exclusive && g_async_queue_length_unlocked (real->queue) >= 0)
|
||||||
{
|
/* No thread is waiting in the queue */
|
||||||
/* No thread is waiting in the queue */
|
g_thread_pool_start_thread (real, error);
|
||||||
g_thread_pool_start_thread (real);
|
|
||||||
}
|
|
||||||
g_async_queue_push_unlocked (real->queue, data);
|
g_async_queue_push_unlocked (real->queue, data);
|
||||||
g_async_queue_unlock (real->queue);
|
g_async_queue_unlock (real->queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
g_thread_pool_set_max_threads (GThreadPool *pool,
|
g_thread_pool_set_max_threads (GThreadPool *pool,
|
||||||
gint max_threads)
|
gint max_threads,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
GRealThreadPool *real = (GRealThreadPool*) pool;
|
GRealThreadPool *real = (GRealThreadPool*) pool;
|
||||||
gint to_start;
|
gint to_start;
|
||||||
@ -314,8 +335,16 @@ g_thread_pool_set_max_threads (GThreadPool *pool,
|
|||||||
to_start = g_async_queue_length_unlocked (real->queue);
|
to_start = g_async_queue_length_unlocked (real->queue);
|
||||||
|
|
||||||
for ( ; to_start > 0; to_start--)
|
for ( ; to_start > 0; to_start--)
|
||||||
g_thread_pool_start_thread (real);
|
{
|
||||||
|
GError *local_error = NULL;
|
||||||
|
g_thread_pool_start_thread (real, &local_error);
|
||||||
|
if (local_error)
|
||||||
|
{
|
||||||
|
g_propagate_error (error, local_error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_async_queue_unlock (real->queue);
|
g_async_queue_unlock (real->queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ test_g_mutex (void)
|
|||||||
g_assert (G_TRYLOCK (test_g_mutex));
|
g_assert (G_TRYLOCK (test_g_mutex));
|
||||||
thread = g_thread_create (test_g_mutex_thread,
|
thread = g_thread_create (test_g_mutex_thread,
|
||||||
GINT_TO_POINTER (42),
|
GINT_TO_POINTER (42),
|
||||||
0, TRUE, TRUE, G_THREAD_PRIORITY_NORMAL);
|
0, TRUE, TRUE, G_THREAD_PRIORITY_NORMAL, NULL);
|
||||||
g_usleep (G_MICROSEC);
|
g_usleep (G_MICROSEC);
|
||||||
test_g_mutex_int = 42;
|
test_g_mutex_int = 42;
|
||||||
G_UNLOCK (test_g_mutex);
|
G_UNLOCK (test_g_mutex);
|
||||||
@ -62,7 +62,7 @@ test_g_static_rec_mutex (void)
|
|||||||
g_assert (g_static_rec_mutex_trylock (&test_g_static_rec_mutex_mutex));
|
g_assert (g_static_rec_mutex_trylock (&test_g_static_rec_mutex_mutex));
|
||||||
thread = g_thread_create (test_g_static_rec_mutex_thread,
|
thread = g_thread_create (test_g_static_rec_mutex_thread,
|
||||||
GINT_TO_POINTER (42),
|
GINT_TO_POINTER (42),
|
||||||
0, TRUE, TRUE, G_THREAD_PRIORITY_NORMAL);
|
0, TRUE, TRUE, G_THREAD_PRIORITY_NORMAL, NULL);
|
||||||
g_usleep (G_MICROSEC);
|
g_usleep (G_MICROSEC);
|
||||||
g_assert (g_static_rec_mutex_trylock (&test_g_static_rec_mutex_mutex));
|
g_assert (g_static_rec_mutex_trylock (&test_g_static_rec_mutex_mutex));
|
||||||
g_usleep (G_MICROSEC);
|
g_usleep (G_MICROSEC);
|
||||||
@ -136,7 +136,7 @@ test_g_static_private (void)
|
|||||||
threads[i] = g_thread_create (test_g_static_private_thread,
|
threads[i] = g_thread_create (test_g_static_private_thread,
|
||||||
GINT_TO_POINTER (i),
|
GINT_TO_POINTER (i),
|
||||||
0, TRUE, TRUE,
|
0, TRUE, TRUE,
|
||||||
G_THREAD_PRIORITY_NORMAL);
|
G_THREAD_PRIORITY_NORMAL, NULL);
|
||||||
}
|
}
|
||||||
for (i = 0; i < THREADS; i++)
|
for (i = 0; i < THREADS; i++)
|
||||||
{
|
{
|
||||||
@ -213,7 +213,7 @@ test_g_static_rw_lock ()
|
|||||||
{
|
{
|
||||||
threads[i] = g_thread_create (test_g_static_rw_lock_thread,
|
threads[i] = g_thread_create (test_g_static_rw_lock_thread,
|
||||||
0, 0, TRUE, TRUE,
|
0, 0, TRUE, TRUE,
|
||||||
G_THREAD_PRIORITY_NORMAL);
|
G_THREAD_PRIORITY_NORMAL, NULL);
|
||||||
}
|
}
|
||||||
g_usleep (G_MICROSEC);
|
g_usleep (G_MICROSEC);
|
||||||
test_g_static_rw_lock_run = FALSE;
|
test_g_static_rw_lock_run = FALSE;
|
||||||
|
@ -33,17 +33,17 @@ main (int argc,
|
|||||||
g_thread_init (NULL);
|
g_thread_init (NULL);
|
||||||
|
|
||||||
pool1 = g_thread_pool_new (thread_pool_func, 3, 0, FALSE,
|
pool1 = g_thread_pool_new (thread_pool_func, 3, 0, FALSE,
|
||||||
G_THREAD_PRIORITY_NORMAL, FALSE, NULL);
|
G_THREAD_PRIORITY_NORMAL, FALSE, NULL, NULL);
|
||||||
pool2 = g_thread_pool_new (thread_pool_func, 5, 0, FALSE,
|
pool2 = g_thread_pool_new (thread_pool_func, 5, 0, FALSE,
|
||||||
G_THREAD_PRIORITY_LOW, FALSE, NULL);
|
G_THREAD_PRIORITY_LOW, FALSE, NULL, NULL);
|
||||||
pool3 = g_thread_pool_new (thread_pool_func, 7, 0, FALSE,
|
pool3 = g_thread_pool_new (thread_pool_func, 7, 0, FALSE,
|
||||||
G_THREAD_PRIORITY_LOW, TRUE, NULL);
|
G_THREAD_PRIORITY_LOW, TRUE, NULL, NULL);
|
||||||
|
|
||||||
for (i = 0; i < RUNS; i++)
|
for (i = 0; i < RUNS; i++)
|
||||||
{
|
{
|
||||||
g_thread_pool_push (pool1, GUINT_TO_POINTER (1));
|
g_thread_pool_push (pool1, GUINT_TO_POINTER (1), NULL);
|
||||||
g_thread_pool_push (pool2, GUINT_TO_POINTER (1));
|
g_thread_pool_push (pool2, GUINT_TO_POINTER (1), NULL);
|
||||||
g_thread_pool_push (pool3, GUINT_TO_POINTER (1));
|
g_thread_pool_push (pool3, GUINT_TO_POINTER (1), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_thread_pool_free (pool1, FALSE, TRUE);
|
g_thread_pool_free (pool1, FALSE, TRUE);
|
||||||
|
Loading…
Reference in New Issue
Block a user