/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
* ---
*
* lwp.c: Interface from Empire threads to LWP threads
- *
+ *
* Known contributors to this file:
* Sasha Mikheev
- * Markus Armbruster, 2006-2007
+ * Markus Armbruster, 2006-2008
*/
#include <config.h>
#include <signal.h>
#include <time.h>
#include "empthread.h"
+#include "file.h"
#include "misc.h"
/* Flags that were passed to empth_init() */
{
if (!flags)
flags = empth_flags;
+ ef_make_stale();
return lwpCreate(1, entry, size, flags, name, 0, 0, ud);
}
}
char *
-empth_name(void)
+empth_name(empth_t *thread)
{
- return lwpName(LwpCurrent);
+ return lwpName(thread);
}
void
-empth_set_name(char *name)
+empth_set_name(empth_t *thread, char *name)
{
- lwpSetName(LwpCurrent, name);
+ lwpSetName(thread, name);
}
void
empth_exit(void)
{
+ ef_make_stale();
lwpExit();
}
void
empth_yield(void)
{
+ ef_make_stale();
lwpYield();
}
-void
-empth_terminate(empth_t *a)
-{
- lwpTerminate(a);
-}
-
-void
-empth_select(int fd, int flags)
+int
+empth_select(int fd, int flags, struct timeval *timeout)
{
- lwpSleepFd(fd, flags);
+ ef_make_stale();
+ return lwpSleepFd(fd, flags, timeout);
}
void
int
empth_sleep(time_t until)
{
+ ef_make_stale();
return lwpSleepUntil(until);
}
int sig, err;
time_t now;
+ ef_make_stale();
sigemptyset(&set);
sigaddset(&set, SIGHUP);
sigaddset(&set, SIGINT);
void
empth_rwlock_wrlock(empth_rwlock_t *rwlock)
{
+ ef_make_stale();
lwp_rwlock_wrlock(rwlock);
}
void
empth_rwlock_rdlock(empth_rwlock_t *rwlock)
{
+ ef_make_stale();
lwp_rwlock_rdlock(rwlock);
}