Skip to content

Commit 514aa4e

Browse files
committed
remove dead code
1 parent a619035 commit 514aa4e

File tree

1 file changed

+0
-84
lines changed

1 file changed

+0
-84
lines changed

win32/time.c

-84
Original file line numberDiff line numberDiff line change
@@ -116,90 +116,6 @@ PHPAPI int nanosleep( const struct timespec * rqtp, struct timespec * rmtp )
116116
return usleep( rqtp->tv_sec * 1000000 + rqtp->tv_nsec / 1000 );
117117
}
118118

119-
#if 0 /* looks pretty ropey in here */
120-
#ifdef HAVE_SETITIMER
121-
122-
123-
#ifndef THREAD_SAFE
124-
unsigned int proftimer, virttimer, realtimer;
125-
extern LPMSG phpmsg;
126-
#endif
127-
128-
struct timer_msg {
129-
int signal;
130-
unsigned int threadid;
131-
};
132-
133-
134-
LPTIMECALLBACK setitimer_timeout(UINT uTimerID, UINT info, DWORD dwUser, DWORD dw1, DWORD dw2)
135-
{
136-
struct timer_msg *msg = (struct timer_msg *) info;
137-
138-
if (msg) {
139-
raise((int) msg->signal);
140-
PostThreadMessage(msg->threadid,
141-
WM_NOTIFY, msg->signal, 0);
142-
free(msg);
143-
}
144-
return 0;
145-
}
146-
147-
PHPAPI int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
148-
{
149-
int timeout = value->it_value.tv_sec * 1000 + value->it_value.tv_usec;
150-
int repeat = TIME_ONESHOT;
151-
152-
/*make sure the message queue is initialized */
153-
PeekMessage(phpmsg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
154-
if (timeout > 0) {
155-
struct timer_msg *msg = malloc(sizeof(struct timer_msg));
156-
msg->threadid = GetCurrentThreadId();
157-
if (!ovalue) {
158-
repeat = TIME_PERIODIC;
159-
}
160-
switch (which) {
161-
case ITIMER_REAL:
162-
msg->signal = SIGALRM;
163-
realtimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
164-
break;
165-
case ITIMER_VIRT:
166-
msg->signal = SIGVTALRM;
167-
virttimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
168-
break;
169-
case ITIMER_PROF:
170-
msg->signal = SIGPROF;
171-
proftimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
172-
break;
173-
default:
174-
errno = EINVAL;
175-
return -1;
176-
break;
177-
}
178-
} else {
179-
switch (which) {
180-
case ITIMER_REAL:
181-
timeKillEvent(realtimer);
182-
break;
183-
case ITIMER_VIRT:
184-
timeKillEvent(virttimer);
185-
break;
186-
case ITIMER_PROF:
187-
timeKillEvent(proftimer);
188-
break;
189-
default:
190-
errno = EINVAL;
191-
return -1;
192-
break;
193-
}
194-
}
195-
196-
197-
return 0;
198-
}
199-
200-
#endif
201-
#endif
202-
203119
/*
204120
* Local variables:
205121
* tab-width: 4

0 commit comments

Comments
 (0)