summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorGuillaume Friloux <guillaume.friloux@gmail.com>2013-12-26 15:35:40 +0100
committerGuillaume Friloux <guillaume.friloux@gmail.com>2013-12-26 15:35:40 +0100
commitf428b4124d46bef42940f31a04945db762fe8d70 (patch)
tree5ab84bacfb86cdcf571d3292c3000ed7edf76e1a /src/lib
parentbf3fb12aab909f4b6a2717c3ba41bc14eb92bf9a (diff)
Allow to pause/resume poll over a file.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/spy/spy_file.c2
-rw-r--r--src/lib/spy/spy_main.c16
-rw-r--r--src/lib/spy/spy_private.h3
3 files changed, 19 insertions, 2 deletions
diff --git a/src/lib/spy/spy_file.c b/src/lib/spy/spy_file.c
index 307e133..adef42d 100644
--- a/src/lib/spy/spy_file.c
+++ b/src/lib/spy/spy_file.c
@@ -140,7 +140,7 @@ spy_file_poll(void *data)
140 Ecore_Thread *et; 140 Ecore_Thread *et;
141 141
142 sf = data; 142 sf = data;
143 if (sf->poll.running) 143 if ((sf->poll.running) || (sf->poll.pause))
144 return EINA_TRUE; 144 return EINA_TRUE;
145 145
146 /* We should have different actions made depending on error type. */ 146 /* We should have different actions made depending on error type. */
diff --git a/src/lib/spy/spy_main.c b/src/lib/spy/spy_main.c
index b4ca263..3cc7f0c 100644
--- a/src/lib/spy/spy_main.c
+++ b/src/lib/spy/spy_main.c
@@ -34,6 +34,22 @@ spy_free(Spy *spy)
34 free(spy); 34 free(spy);
35} 35}
36 36
37void
38spy_file_pause(Spy_File *sf)
39{
40 EINA_SAFETY_ON_NULL_RETURN(sf);
41
42 sf->poll.pause = EINA_TRUE;
43}
44
45void
46spy_file_resume(Spy_File *sf)
47{
48 EINA_SAFETY_ON_NULL_RETURN(sf);
49
50 sf->poll.pause = EINA_FALSE;
51}
52
37Spy_File * 53Spy_File *
38spy_file_get(Spy *spy, const char *file) 54spy_file_get(Spy *spy, const char *file)
39{ 55{
diff --git a/src/lib/spy/spy_private.h b/src/lib/spy/spy_private.h
index ad32258..26ddfae 100644
--- a/src/lib/spy/spy_private.h
+++ b/src/lib/spy/spy_private.h
@@ -24,7 +24,8 @@ struct _Spy_File
24 { 24 {
25 Ecore_Timer *timer; 25 Ecore_Timer *timer;
26 off_t size; 26 off_t size;
27 Eina_Bool running; 27 Eina_Bool running,
28 pause;
28 } poll; 29 } poll;
29 30
30 struct 31 struct