[tracker/cpuaffinity] tracker-store: Protect non-portable GNU functions from compilation error
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/cpuaffinity] tracker-store: Protect non-portable GNU functions from compilation error
- Date: Thu, 1 Jul 2010 14:35:49 +0000 (UTC)
commit deb4b22a28a17de28c682764f81b46c1b085c78c
Author: Martyn Russell <martyn lanedo com>
Date: Thu Jul 1 15:35:33 2010 +0100
tracker-store: Protect non-portable GNU functions from compilation error
src/tracker-store/tracker-store.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-store/tracker-store.c b/src/tracker-store/tracker-store.c
index 6d9e1d3..838fb77 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -108,8 +108,10 @@ typedef struct {
static GStaticPrivate private_key = G_STATIC_PRIVATE_INIT;
+#ifdef __USE_GNU
/* cpu used for mainloop thread and main update/query thread */
static int main_cpu;
+#endif /* __USE_GNU */
static void start_handler (TrackerStorePrivate *private);
@@ -453,6 +455,7 @@ pool_dispatch_cb (gpointer data,
TrackerStoreTask *task;
GThread *running_thread = g_thread_self ();
+#ifdef __USE_GNU
/* special task, only ever sent to main pool */
if (GPOINTER_TO_INT (data) == 1) {
cpu_set_t cpuset;
@@ -463,6 +466,7 @@ pool_dispatch_cb (gpointer data,
pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
return;
}
+#endif /* __USE_GNU */
private = user_data;
task = data;
@@ -615,14 +619,15 @@ queue_idle_destroy (gpointer user_data)
private->have_handler = FALSE;
}
-
void
tracker_store_init (void)
{
TrackerStorePrivate *private;
gint i;
const char *tmp;
+#ifdef __USE_GNU
cpu_set_t cpuset;
+#endif /* __USE_GNU */
private = g_new0 (TrackerStorePrivate, 1);
@@ -649,6 +654,7 @@ tracker_store_init (void)
g_thread_pool_set_max_idle_time (15 * 1000);
g_thread_pool_set_max_unused_threads (2);
+#ifdef __USE_GNU
main_cpu = sched_getcpu ();
CPU_ZERO (&cpuset);
CPU_SET (main_cpu, &cpuset);
@@ -657,12 +663,13 @@ tracker_store_init (void)
pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
/* lock main update/query thread to same cpu to improve overall performance
main loop thread is essentially idle during query execution */
+#endif /* __USE_GNU */
+
g_thread_pool_push (private->main_pool, GINT_TO_POINTER (1), NULL);
g_static_private_set (&private_key,
private,
private_free);
-
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]