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
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/* Milkway
*
* Copyright (C) 2008- Luo Jinghua <sunmoon1997@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "milkwayint.h"
#include "mw-poll-sys-private.h"
#include <time.h>
#include <stdlib.h>
#ifdef MW_OS_WINDOWS
#include <windows.h>
static mw_poll_win32_t*
mw_poll_win32_init(mw_poll_win32_t *self,
mw_poll_win32_type_t *type)
{
if (!mw_poll_init(&self->base, &type->base))
return NULL;
return self;
}
mw_poll_t*
mw_poll_win32_new(void)
{
mw_poll_win32_t *self = mw_object_alloc(MW_POLL_WIN32_TYPE);
if (!self)
return NULL;
return (mw_poll_t*)mw_poll_win32_init(self, MW_POLL_WIN32_TYPE);
}
static mw_bool_t
mw_poll_win32_add_fd(mw_poll_t *super,
mw_pollfd_t *fd,
mw_error_t **reterr)
{
mw_poll_win32_t *self = (mw_poll_win32_t*)super;
return MW_TRUE;
}
static mw_bool_t
mw_poll_win32_remove_fd(mw_poll_t *super,
mw_pollfd_t *fd,
mw_error_t **reterr)
{
mw_poll_win32_t *self = (mw_poll_win32_t*)super;
return MW_TRUE;
}
static mw_bool_t
mw_poll_win32_poll(mw_poll_t *super,
int timeout)
{
mw_poll_win32_t *self = (mw_poll_win32_t*)super;
return MW_FALSE;
}
static void
mw_poll_win32_finalize(mw_object_t *super)
{
mw_poll_win32_t *self = (mw_poll_win32_t*)super;
MW_SUPER_TYPE_BASE(super, MW_POLL_WIN32_TYPE)->finalize(super);
}
static void
mw_poll_win32_type_init(mw_poll_win32_type_t *self)
{
self->base.base.finalize = mw_poll_win32_finalize;
self->base.add_fd = mw_poll_win32_add_fd;
self->base.remove_fd = mw_poll_win32_remove_fd;
self->base.poll = mw_poll_win32_poll;
}
MW_DEFINE_GET_TYPE(mw_poll_win32, mw_poll_win32_type_t,
MW_POLL_TYPE, "MWPollWin32", 0);
#endif
|