Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 1e948f7f authored by rswindell's avatar rswindell

Utilizing mutex for input_thread instead of Win32 suspend/resume thread...

Utilizing mutex for input_thread instead of Win32 suspend/resume thread functions (for Unix compatibility).
parent 623c0fc7
......@@ -123,6 +123,7 @@ public:
RingBuf outbuf;
sem_t output_sem;
HANDLE input_thread;
pthread_mutex_t input_thread_mutex;
int outcom(uchar ch); // send character
int incom(void); // receive character
......@@ -139,8 +140,8 @@ public:
uchar telnet_last_rxch;
bool event_thread_running;
bool input_thread_running;
bool output_thread_running;
bool input_thread_running;
char menu_dir[128]; /* Over-ride default menu dir */
char menu_file[128]; /* Over-ride menu file */
......
......@@ -137,9 +137,11 @@ extern "C" {
#define sem_wait(psem) WaitForSingleObject(*(psem),INFINITE)
#define sem_post(psem) SetEvent(*(psem))
#define sem_destroy(psem) CloseHandle(*(psem))
int sem_getvalue(sem_t*, int* val);
/* POIX mutexes */
typedef HANDLE pthread_mutex_t;
#define PTHREAD_MUTEX_INITIALIZER CreateMutex(NULL,FALSE,NULL)
#define pthread_mutex_init(pmtx,v) *(pmtx)=CreateMutex(NULL,FALSE,NULL)
#define pthread_mutex_lock(pmtx) WaitForSingleObject(*(pmtx),INFINITE)
#define pthread_mutex_unlock(pmtx) ReleaseMutex(*(pmtx))
......
......@@ -436,7 +436,11 @@ int sbbs_t::external(char* cmdline, long mode, char* startup_dir)
fclose(fp);
/* not temporary */
#if 0
SuspendThread(input_thread);
#else
pthread_mutex_lock(&input_thread_mutex);
#endif
}
if(!CreateProcess(
......@@ -706,7 +710,11 @@ int sbbs_t::external(char* cmdline, long mode, char* startup_dir)
CloseHandle(hungup_event);
if(native)
#if 0
ResumeThread(input_thread);
#else
pthread_mutex_unlock(&input_thread_mutex);
#endif
else { // Get return value
sprintf(str,"%sDOSXTRN.RET", cfg.node_dir);
FILE* fp=fopen(str,"r");
......@@ -789,6 +797,8 @@ int sbbs_t::external(char* cmdline, long mode, char* startup_dir)
return(-1);
}
pthread_mutex_lock(&input_thread_mutex);
if(pid==0) { /* child process */
if(startup_dir!=NULL && startup_dir[0])
chdir(startup_dir);
......@@ -808,13 +818,11 @@ int sbbs_t::external(char* cmdline, long mode, char* startup_dir)
exit(-1); /* should never get here */
}
while(1) {
if(waitpid(pid, &i, 0)==-1) {
if(errno!=EINTR)
return(-1);
} else
return(WEXITSTATUS(i));
}
waitpid(pid, &i, 0);
pthread_mutex_unlock(&input_thread_mutex);
return(WEXITSTATUS(i));
}
#endif /* !WIN32 */
......@@ -947,7 +955,7 @@ char * sbbs_t::cmdstr(char *instr, char *fpath, char *fspec, char *outstr)
#ifdef __OS2__
strcpy(str,"OS2");
#else
strcat(str,PLATFORM_DESC);
strcpy(str,PLATFORM_DESC);
#endif
strlwr(str);
strcat(cmd,str);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment