mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 06:53:33 +00:00
Remove old Windows thread hack from Redbean
This commit is contained in:
parent
de3f3a9e5a
commit
4658ae539f
1 changed files with 2 additions and 41 deletions
|
@ -7014,14 +7014,8 @@ static int HandlePoll(int ms) {
|
||||||
#ifndef STATIC
|
#ifndef STATIC
|
||||||
} else if (__replmode) {
|
} else if (__replmode) {
|
||||||
// handle refresh repl line
|
// handle refresh repl line
|
||||||
if (!IsWindows()) {
|
rc = HandleReadline();
|
||||||
rc = HandleReadline();
|
if (rc < 0) return rc;
|
||||||
if (rc < 0) return rc;
|
|
||||||
} else {
|
|
||||||
strace_enabled(-1);
|
|
||||||
linenoiseRefreshLine(lua_repl_linenoise);
|
|
||||||
strace_enabled(+1);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -7172,31 +7166,6 @@ static void ReplEventLoop(void) {
|
||||||
polls[0].fd = -1;
|
polls[0].fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int WindowsReplThread(void *arg, int tid) {
|
|
||||||
int sig;
|
|
||||||
lua_State *L = GL;
|
|
||||||
DEBUGF("(repl) started windows thread");
|
|
||||||
lua_repl_blocking = true;
|
|
||||||
lua_repl_completions_callback = HandleCompletions;
|
|
||||||
lua_initrepl(L);
|
|
||||||
EnableRawMode();
|
|
||||||
while (!terminated) {
|
|
||||||
if (HandleReadline() == -1) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DisableRawMode();
|
|
||||||
lua_freerepl();
|
|
||||||
lua_repl_lock();
|
|
||||||
lua_settop(L, 0); // clear stack
|
|
||||||
lua_repl_unlock();
|
|
||||||
if ((sig = linenoiseGetInterrupt())) {
|
|
||||||
raise(sig);
|
|
||||||
}
|
|
||||||
DEBUGF("(repl) terminating windows thread");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void InstallSignalHandler(int sig, void *handler) {
|
static void InstallSignalHandler(int sig, void *handler) {
|
||||||
struct sigaction sa = {.sa_sigaction = handler};
|
struct sigaction sa = {.sa_sigaction = handler};
|
||||||
if (sigaction(sig, &sa, 0) == -1)
|
if (sigaction(sig, &sa, 0) == -1)
|
||||||
|
@ -7477,9 +7446,6 @@ void RedBean(int argc, char *argv[]) {
|
||||||
GetResolvConf(); // for effect
|
GetResolvConf(); // for effect
|
||||||
if (daemonize || uniprocess || !linenoiseIsTerminal()) {
|
if (daemonize || uniprocess || !linenoiseIsTerminal()) {
|
||||||
EventLoop(timespec_tomillis(heartbeatinterval));
|
EventLoop(timespec_tomillis(heartbeatinterval));
|
||||||
} else if (IsWindows()) {
|
|
||||||
CHECK_NE(-1, _spawn(WindowsReplThread, 0, &replth));
|
|
||||||
EventLoop(100);
|
|
||||||
} else {
|
} else {
|
||||||
ReplEventLoop();
|
ReplEventLoop();
|
||||||
}
|
}
|
||||||
|
@ -7514,11 +7480,6 @@ int main(int argc, char *argv[]) {
|
||||||
// 2. unwound worker exit
|
// 2. unwound worker exit
|
||||||
if (IsModeDbg()) {
|
if (IsModeDbg()) {
|
||||||
if (isexitingworker) {
|
if (isexitingworker) {
|
||||||
if (IsWindows()) {
|
|
||||||
// TODO(jart): Get windows worker leak detector working again.
|
|
||||||
return 0;
|
|
||||||
CloseServerFds();
|
|
||||||
}
|
|
||||||
_join(&replth);
|
_join(&replth);
|
||||||
linenoiseDisableRawMode();
|
linenoiseDisableRawMode();
|
||||||
linenoiseHistoryFree();
|
linenoiseHistoryFree();
|
||||||
|
|
Loading…
Reference in a new issue