File: thread_application_context.c.in

package info (click to toggle)
gsequencer 7.7.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 71,040 kB
  • sloc: ansic: 1,145,949; xml: 31,016; cpp: 9,487; sh: 5,798; makefile: 3,845; perl: 155; sed: 16; python: 11
file content (62 lines) | stat: -rw-r--r-- 1,744 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* Copyright (C) 2005-2021 Joël Krähemann
 * Permission is granted to copy, distribute and/or modify this document
 * under the terms of the GNU Free Documentation License, Version 1.3
 * or any later version published by the Free Software Foundation;
 * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 * A copy of the license is included in the section entitled "GNU
 * Free Documentation License".
 */

#include <glib.h>
#include <glib-object.h>

#include <ags/libags.h>

void setup_callback(AgsApplicationContext *application_context, gpointer user_data);
gboolean loader_timeout(AgsApplicationContext *application_context);

#define DEFAULT_LOADER_INTERVAL (1000 / 25)

AgsApplicationContext *application_context;
gboolean start_loader;

application_context = (AgsApplicationContext *) ags_thread_application_context_new();
g_object_ref(application_context);

g_signal_connect_after(application_context, "setup",
		       G_CALLBACK(setup_callback), NULL);

start_loader = FALSE;

g_timeout_add(DEFAULT_LOADER_INTERVAL,
	      loader_timeout,
	      application_context);

ags_application_context_prepare(application_context);
ags_application_context_setup(application_context);
  
/* main loop run */
g_main_loop_run(g_main_loop_new(g_main_context_default(),
				TRUE));

void
setup_callback(AgsApplicationContext *application_context, gpointer user_data)
{
  start_loader = TRUE;
}

gboolean
loader_timeout(AgsApplicationContext *application_context)
{
  AgsTaskLauncher *task_launcher;
  
  if(!start_loader){
    return(TRUE);
  }
  
  task_launcher = ags_concurrency_provider_get_task_launcher(AGS_CONCURRENCY_PROVIDER(application_context));

  //TODO: add some tasks to task_launcher

  return(FALSE);
}