summaryrefslogtreecommitdiffstats
path: root/flow/gsl/gsloputil.h
blob: 116154f2dc8513ba3ed89bef32991661883d6cda (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* GSL Engine - Flow module operation engine
 * Copyright (C) 2001 Tim Janik
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
 * Public License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */
#ifndef __GSL_ENGINE_UTIL_H__
#define __GSL_ENGINE_UTIL_H__

#include <gsl/gsldefs.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


/* --- typedefs --- */
typedef struct _EngineNode     EngineNode;
typedef struct _EngineSchedule EngineSchedule;


/* --- UserThread --- */
void		_engine_free_trans		(GslTrans      *trans);
GslOStream*	_engine_alloc_ostreams		(guint		n);
#if 0	/* gslengine.h: */
void            gsl_engine_garbage_collect	(void);
gfloat*		gsl_engine_const_values		(gfloat		value);
#endif


/* --- MasterThread --- */
void		_engine_recycle_const_values	(void);
/* master node list */
void		_engine_mnl_remove		(EngineNode	*node);
void		_engine_mnl_reorder		(EngineNode	*node);
void		_engine_mnl_integrate		(EngineNode	*node);
#define	GSL_MNL_HEAD_NODE(node)			((node)->flow_jobs && !(node)->sched_tag)
EngineNode*	_engine_mnl_head		(void);

/* communication routines for threads:
 * UserThread   - main application
 * MasterThread - op engine control thread
 * SlaveThread  - op engine calculation threads
 *
 * these functions are for _internal_ use of gslop*.c implementations
 */

/* --- job transactions --- */
/* UserThread */
void		_engine_enqueue_trans	(GslTrans	*trans);
GslTrans*	_engine_collect_trans	(void);
void		_engine_wait_on_trans	(void);
/* MasterThread */
/* GslJob*	_engine_pop_job_timed	(glong		 max_useconds); */
GslJob*		_engine_pop_job		(void);
gboolean	_engine_job_pending	(void);


/* --- node processing queue --- */
void	    _engine_set_schedule		(EngineSchedule	*schedule);
void	    _engine_unset_schedule		(EngineSchedule	*schedule);
EngineNode* _engine_pop_unprocessed_node	(void);
void	    _engine_push_processed_node		(EngineNode	*node);
GslRing*    _engine_pop_unprocessed_cycle	(void);
void	    _engine_push_processed_cycle	(GslRing	*cycle);
void	    _engine_wait_on_unprocessed		(void);

       

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __GSL_ENGINE_UTIL_H__ */