1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2019 Joël Krähemann
3  *
4  * This file is part of GSequencer.
5  *
6  * GSequencer is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * GSequencer is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GSequencer.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef __AGS_CONCURRENCY_PROVIDER_H__
21 #define __AGS_CONCURRENCY_PROVIDER_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 #include <ags/thread/ags_thread.h>
27 #include <ags/thread/ags_task_launcher.h>
28 #include <ags/thread/ags_thread_pool.h>
29 
30 G_BEGIN_DECLS
31 
32 #define AGS_TYPE_CONCURRENCY_PROVIDER                    (ags_concurrency_provider_get_type())
33 #define AGS_CONCURRENCY_PROVIDER(obj)                    (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_CONCURRENCY_PROVIDER, AgsConcurrencyProvider))
34 #define AGS_CONCURRENCY_PROVIDER_INTERFACE(vtable)       (G_TYPE_CHECK_CLASS_CAST((vtable), AGS_TYPE_CONCURRENCY_PROVIDER, AgsConcurrencyProviderInterface))
35 #define AGS_IS_CONCURRENCY_PROVIDER(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_CONCURRENCY_PROVIDER))
36 #define AGS_IS_CONCURRENCY_PROVIDER_INTERFACE(vtable)    (G_TYPE_CHECK_CLASS_TYPE((vtable), AGS_TYPE_CONCURRENCY_PROVIDER))
37 #define AGS_CONCURRENCY_PROVIDER_GET_INTERFACE(obj)      (G_TYPE_INSTANCE_GET_INTERFACE((obj), AGS_TYPE_CONCURRENCY_PROVIDER, AgsConcurrencyProviderInterface))
38 
39 typedef struct _AgsConcurrencyProvider AgsConcurrencyProvider;
40 typedef struct _AgsConcurrencyProviderInterface AgsConcurrencyProviderInterface;
41 
42 struct _AgsConcurrencyProviderInterface
43 {
44   GTypeInterface ginterface;
45 
46   AgsThread* (*get_main_loop)(AgsConcurrencyProvider *concurrency_provider);
47   void (*set_main_loop)(AgsConcurrencyProvider *concurrency_provider,
48 			AgsThread *main_loop);
49 
50   AgsTaskLauncher* (*get_task_launcher)(AgsConcurrencyProvider *concurrency_provider);
51   void (*set_task_launcher)(AgsConcurrencyProvider *concurrency_provider,
52 			    AgsTaskLauncher *task_launcher);
53 
54   AgsThreadPool* (*get_thread_pool)(AgsConcurrencyProvider *concurrency_provider);
55   void (*set_thread_pool)(AgsConcurrencyProvider *concurrency_provider,
56 			  AgsThreadPool *thread_pool);
57 
58   GList* (*get_worker)(AgsConcurrencyProvider *concurrency_provider);
59   void (*set_worker)(AgsConcurrencyProvider *concurrency_provider,
60 		     GList *worker);
61 };
62 
63 GType ags_concurrency_provider_get_type();
64 
65 AgsThread* ags_concurrency_provider_get_main_loop(AgsConcurrencyProvider *concurrency_provider);
66 void ags_concurrency_provider_set_main_loop(AgsConcurrencyProvider *concurrency_provider,
67 					    AgsThread *main_loop);
68 
69 AgsTaskLauncher* ags_concurrency_provider_get_task_launcher(AgsConcurrencyProvider *concurrency_provider);
70 void ags_concurrency_provider_set_task_launcher(AgsConcurrencyProvider *concurrency_provider,
71 						AgsTaskLauncher *task_launcher);
72 
73 AgsThreadPool* ags_concurrency_provider_get_thread_pool(AgsConcurrencyProvider *concurrency_provider);
74 void ags_concurrency_provider_set_thread_pool(AgsConcurrencyProvider *concurrency_provider,
75 					      AgsThreadPool *thread_pool);
76 
77 GList* ags_concurrency_provider_get_worker(AgsConcurrencyProvider *concurrency_provider);
78 void ags_concurrency_provider_set_worker(AgsConcurrencyProvider *concurrency_provider,
79 					 GList *worker);
80 
81 G_END_DECLS
82 
83 #endif /*__AGS_CONCURRENCY_PROVIDER_H__*/
84