mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-11 21:34:53 -04:00
Fix whitespace.
This commit is contained in:
parent
b00d4c0452
commit
cb927a5173
8
evmap.c
8
evmap.c
@ -691,7 +691,7 @@ event_changelist_del(struct event_base *base, evutil_socket_t fd, short old, sho
|
||||
|
||||
As well as checking the current operation we should also check
|
||||
the original set of events to make sure were not ignoring
|
||||
the case where the add operation is present on an event that
|
||||
the case where the add operation is present on an event that
|
||||
was already set.
|
||||
|
||||
If we have a no-op item, we could remove it it from the list
|
||||
@ -699,19 +699,19 @@ event_changelist_del(struct event_base *base, evutil_socket_t fd, short old, sho
|
||||
change when we do the dispatch later is far cheaper than rejuggling
|
||||
the array now.
|
||||
|
||||
As this stands, it also lets through deletions of events that are
|
||||
As this stands, it also lets through deletions of events that are
|
||||
not currently set.
|
||||
*/
|
||||
|
||||
if (events & (EV_READ|EV_SIGNAL)) {
|
||||
if (!(change->old_events & (EV_READ | EV_SIGNAL)) &&
|
||||
if (!(change->old_events & (EV_READ | EV_SIGNAL)) &&
|
||||
(change->read_change & EV_CHANGE_ADD))
|
||||
change->read_change = 0;
|
||||
else
|
||||
change->read_change = EV_CHANGE_DEL;
|
||||
}
|
||||
if (events & EV_WRITE) {
|
||||
if (!(change->old_events & EV_WRITE) &&
|
||||
if (!(change->old_events & EV_WRITE) &&
|
||||
(change->write_change & EV_CHANGE_ADD))
|
||||
change->write_change = 0;
|
||||
else
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _EVENT_HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
@ -32,9 +31,9 @@
|
||||
|
||||
static void
|
||||
write_cb(evutil_socket_t fd, short event, void *arg)
|
||||
{
|
||||
{
|
||||
printf("write callback. should only see this once\n");
|
||||
|
||||
|
||||
/* got what we want remove the event */
|
||||
event_del(*(struct event**)arg);
|
||||
|
||||
@ -48,7 +47,7 @@ write_cb(evutil_socket_t fd, short event, void *arg)
|
||||
|
||||
static void
|
||||
timeout_cb(evutil_socket_t fd, short event, void *arg)
|
||||
{
|
||||
{
|
||||
printf("timeout fired, time to end test\n");
|
||||
event_del(*(struct event**)arg);
|
||||
return;
|
||||
@ -111,17 +110,17 @@ main(int argc, char **argv)
|
||||
|
||||
/* attempt to calculate our cpu usage over the test should be
|
||||
virtually nil */
|
||||
|
||||
|
||||
tickspassed = ((((timeEnd.tv_sec - timeBegin.tv_sec) * 1000000.0) +
|
||||
(timeEnd.tv_usec - timeBegin.tv_usec)) *
|
||||
((1.0 * CLOCKS_PER_SEC) / 1000000));
|
||||
|
||||
|
||||
usage = 100.0 * (((int)(ticksEnd-ticksBegin) * 1.0) / tickspassed);
|
||||
|
||||
printf("ticks used=%d, ticks passed=%d, cpu usage=%.2f%%\n",
|
||||
(int)(ticksEnd-ticksBegin),
|
||||
tickspassed,
|
||||
usage);
|
||||
usage);
|
||||
|
||||
if (usage > 50.0) /* way too high */
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user