summaryrefslogtreecommitdiff
path: root/src/ivyloop.h
blob: 63e30f3360efdde8709302c74a003f628140b782 (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
/*
 *	Ivy, C interface
 *
 *	Copyright (C) 1997-2000
 *	Centre d'Études de la Navigation Aérienne
 *
 * 	Main loop handling around select
 *
 *	Authors: François-Régis Colin <fcolin@cena.dgac.fr>
 *		 Stéphane Chatty <chatty@cena.dgac.fr>
 *
 *	$Id$
 * 
 *	Please refer to file version.h for the
 *	copyright notice regarding this software
 *
 */

#ifndef IVYLOOP_H
#define IVYLOOP_H

#ifdef __cplusplus
extern "C" {
#endif

#include "ivychannel.h"

/* general Handle */

#define ANYPORT	0

#ifdef WIN32
#include <windows.h>
#define HANDLE SOCKET
#else
#define HANDLE int
#endif

/*
Boucle principale d'IVY baseé sur un select
les fonctions hook et unhook encradre le select 
de la maniere suivante:

	BeforeSelect est appeler avant l'appel system select
	AfterSelect est appeler avent l'appel system select
	ces function peuvent utilisées pour depose un verrou dans le cas 
	d'utilisation de la mainloop Ivy dans une thread separe
	
	BeforeSelect ==> on libere l'acces avant la mise en attente sur le select
	AfterSelect == > on verrouille l'acces en sortie du select 

	!!!! Attention donc l'appel des callbacks ivy se fait avec l'acces verrouille !
*/

extern void IvyMainLoop(void);

typedef void ( *IvyHookPtr) ( void *data );

extern void IvyChannelAddWritableEvent(Channel channel);
extern void IvyChannelClearWritableEvent(Channel channel);
extern void IvySetBeforeSelectHook(IvyHookPtr before, void *data );
extern void IvySetAfterSelectHook(IvyHookPtr after, void *data );

#ifdef __cplusplus
}
#endif

#endif