Remove old Windows thread hack from Redbean

This commit is contained in:
Justine Tunney 2023-08-15 06:06:43 -07:00
parent de3f3a9e5a
commit 4658ae539f
No known key found for this signature in database
GPG key ID: BE714B4575D6E328

View file

@ -7014,14 +7014,8 @@ static int HandlePoll(int ms) {
#ifndef STATIC
} else if (__replmode) {
// handle refresh repl line
if (!IsWindows()) {
rc = HandleReadline();
if (rc < 0) return rc;
} else {
strace_enabled(-1);
linenoiseRefreshLine(lua_repl_linenoise);
strace_enabled(+1);
}
rc = HandleReadline();
if (rc < 0) return rc;
#endif
}
} else {
@ -7172,31 +7166,6 @@ static void ReplEventLoop(void) {
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) {
struct sigaction sa = {.sa_sigaction = handler};
if (sigaction(sig, &sa, 0) == -1)
@ -7477,9 +7446,6 @@ void RedBean(int argc, char *argv[]) {
GetResolvConf(); // for effect
if (daemonize || uniprocess || !linenoiseIsTerminal()) {
EventLoop(timespec_tomillis(heartbeatinterval));
} else if (IsWindows()) {
CHECK_NE(-1, _spawn(WindowsReplThread, 0, &replth));
EventLoop(100);
} else {
ReplEventLoop();
}
@ -7514,11 +7480,6 @@ int main(int argc, char *argv[]) {
// 2. unwound worker exit
if (IsModeDbg()) {
if (isexitingworker) {
if (IsWindows()) {
// TODO(jart): Get windows worker leak detector working again.
return 0;
CloseServerFds();
}
_join(&replth);
linenoiseDisableRawMode();
linenoiseHistoryFree();