Thread support for Mingw32

This commit is contained in:
jjgarcia 2005-01-31 17:59:46 +00:00
parent 16a4dc38e9
commit 8a4afd0424
21 changed files with 566 additions and 1061 deletions

View file

@ -14,6 +14,9 @@ ECL 0.9f
* Visible changes:
- Multithreaded ECL now in Windows, either with Microsoft VC++
or Mingw32 (M. Goffioul).
- Improvements in the efficiency of macro readers for #a() and #()
- When supplied an :INITIAL-CONTENTS, MAKE-ARRAY now uses a more efficient

10
src/aclocal.m4 vendored
View file

@ -140,7 +140,9 @@ PICFLAG='-fPIC'
LDINSTALLNAME=''
THREAD_CFLAGS=''
THREAD_LDFLAGS=''
THREAD_GC_FLAGS='--enable-threads=posix'
INSTALL_TARGET='install'
THREAD_OBJ='threads'
case "${host_os}" in
# libdir may have a dollar expression inside
linux*)
@ -185,6 +187,7 @@ case "${host_os}" in
cygwin*)
thehost='cygwin'
shared='no'
THREAD_OBJ=''
SHARED_LDFLAGS=''
BUNDLE_LDFLAGS=''
SHAREDPREFIX=''
@ -192,14 +195,19 @@ case "${host_os}" in
;;
mingw*)
thehost='mingw32'
CLIBS='-lwsock32'
CLIBS=''
shared='yes'
THREAD_OBJ='threads_win32'
THREAD_CFLAGS='-D_THREAD_SAFE'
THREAD_LDFLAGS=''
THREAD_GC_FLAGS='--enable-threads=win32'
SHARED_LDFLAGS=''
BUNDLE_LDFLAGS=''
SHAREDPREFIX=''
SHAREDEXT='dll'
PICFLAG=''
INSTALL_TARGET='flatinstall'
TCPLIBS='-lws2_32'
;;
darwin*)
thehost='darwin'

View file

@ -12,7 +12,7 @@
See file '../Copyright' for full details.
*/
#ifdef ECL_THREADS
#if defined(ECL_THREADS) && !defined(_MSC_VER)
#include <pthread.h>
#endif
#include "ecl.h"
@ -59,7 +59,11 @@ finalize(cl_object o, cl_object data)
break;
#ifdef ECL_THREADS
case t_lock:
#if defined(_MSC_VER) || defined(mingw32)
CloseHandle(o->lock.mutex);
#else
pthread_mutex_destroy(&o->lock.mutex);
#endif
break;
#endif
default:;
@ -165,6 +169,7 @@ init_alloc(void)
alloc_initialized = TRUE;
GC_no_dls = 1;
GC_init();
#if 0
GC_init_explicit_typing();
#endif

View file

@ -65,7 +65,7 @@ BEGIN:
switch ((enum ecl_smmode)strm->stream.mode) {
case smm_io:
case smm_input:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
#endif
case smm_concatenated:
@ -75,7 +75,7 @@ BEGIN:
return(TRUE);
case smm_output:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
#endif
case smm_string_output:
@ -111,7 +111,7 @@ BEGIN:
FEtype_error_stream(strm);
switch ((enum ecl_smmode)strm->stream.mode) {
case smm_input:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
#endif
case smm_concatenated:
@ -119,7 +119,7 @@ BEGIN:
return(FALSE);
case smm_output:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
#endif
case smm_io:
@ -163,7 +163,7 @@ BEGIN:
switch ((enum ecl_smmode)strm->stream.mode) {
case smm_input:
case smm_output:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
case smm_output_wsock:
#endif
@ -274,7 +274,7 @@ wrong_file_handler(cl_object strm)
FEerror("Internal error: stream ~S has no valid C file handler.", 1, strm);
}
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
static void
wsock_error( const char *err_msg, cl_object strm )
{
@ -524,7 +524,7 @@ close_stream(cl_object strm, bool abort_flag) /* Not used now! */
strm->stream.file = NULL;
#endif
break;
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
case smm_output_wsock:
if ( closesocket( ( int )strm->stream.file ) != 0 )
@ -653,7 +653,7 @@ ecl_write_byte8(int c, cl_object strm)
io_error(strm);
break;
}
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock: {
int fp = (int)strm->stream.file;
if ( fp == INVALID_SOCKET )
@ -698,7 +698,7 @@ BEGIN:
switch ((enum ecl_smmode)strm->stream.mode) {
case smm_output:
case smm_io:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
#endif
case smm_string_output:
@ -720,7 +720,7 @@ BEGIN:
strm = strm->stream.object1;
goto BEGIN;
case smm_input:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
#endif
case smm_concatenated:
@ -791,7 +791,7 @@ ecl_read_byte8(cl_object strm)
io_error(strm);
break;
}
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock: {
int fp = (int)strm->stream.file;
if ( fp == INVALID_SOCKET )
@ -903,7 +903,7 @@ BEGIN:
case smm_input:
case smm_io:
case smm_string_input:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
#endif
break;
@ -937,7 +937,7 @@ BEGIN:
}
return c;
case smm_output:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
#endif
case smm_broadcast:
@ -1049,7 +1049,7 @@ BEGIN:
io_error(strm);
break;
}
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock: {
int fp = strm->stream.file;
if (!strm->stream.char_stream_p)
@ -1106,7 +1106,7 @@ BEGIN:
break;
case smm_output:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
#endif
case smm_broadcast:
@ -1164,7 +1164,7 @@ BEGIN:
ungetc(c, fp);
break;
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
wsock_error( "Cannot peek char on Windows Socket ~S.~%~A", strm );
break;
@ -1204,7 +1204,7 @@ BEGIN:
break;
case smm_output:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
#endif
case smm_broadcast:
@ -1256,7 +1256,7 @@ BEGIN:
/* --strm->stream.int0; useless in smm_io, Beppe */
break;
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
goto UNREAD_ERROR;
#endif
@ -1287,7 +1287,7 @@ BEGIN:
break;
case smm_output:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
#endif
case smm_broadcast:
@ -1338,7 +1338,7 @@ BEGIN:
io_error(strm);
break;
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
if (!strm->stream.char_stream_p)
not_a_character_stream(strm);
@ -1395,7 +1395,7 @@ BEGIN:
break;
case smm_input:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
#endif
case smm_concatenated:
@ -1601,7 +1601,7 @@ BEGIN:
io_error(strm);
break;
}
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
/* do not do anything (yet) */
break;
@ -1627,7 +1627,7 @@ BEGIN:
break;
}
case smm_input:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
#endif
case smm_concatenated:
@ -1674,7 +1674,7 @@ BEGIN:
}
break;
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
/* do not do anything (yet) */
printf( "Trying to clear input on windows socket stream!\n" );
@ -1698,7 +1698,7 @@ BEGIN:
case smm_string_output:
case smm_io:
case smm_output:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
#endif
case smm_concatenated:
@ -1738,7 +1738,7 @@ BEGIN:
#endif
break;
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
/* do not do anything (yet) */
printf( "Trying to clear output windows socket stream\n!" );
@ -1762,7 +1762,7 @@ BEGIN:
case smm_string_output:
case smm_io:
case smm_input:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
#endif
case smm_concatenated:
@ -1845,7 +1845,7 @@ flisten(FILE *fp)
break;
case FILE_TYPE_PIPE: {
DWORD dw;
if (PeekNamedPipe(hnd, NULL, 0, NULL, &dw, NULL) != 0)
if (PeekNamedPipe(hnd, NULL, 0, NULL, &dw, NULL) == 0)
return (dw > 0 ? ECL_LISTEN_AVAILABLE : ECL_LISTEN_NO_CHAR);
else if (GetLastError() == ERROR_BROKEN_PIPE)
return ECL_LISTEN_EOF;
@ -1897,7 +1897,7 @@ BEGIN:
wrong_file_handler(strm);
return flisten(fp);
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
fp = strm->stream.file;
if ( ( int )fp == INVALID_SOCKET )
@ -1946,7 +1946,7 @@ BEGIN:
return ECL_LISTEN_EOF;
case smm_output:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
#endif
case smm_broadcast:
@ -2006,7 +2006,7 @@ BEGIN:
strm = CAR(strm);
goto BEGIN;
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
case smm_output_wsock:
#endif
@ -2126,7 +2126,7 @@ BEGIN:
strm = CAR(strm);
goto BEGIN;
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
case smm_output_wsock:
#endif
@ -2196,7 +2196,7 @@ BEGIN:
goto BEGIN;
/* FIXME! Should signal an error of type-error */
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
case smm_output_wsock:
#endif
@ -2233,7 +2233,7 @@ BEGIN:
FEclosed_stream(strm);
switch ((enum ecl_smmode)strm->stream.mode) {
case smm_output:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_output_wsock:
#endif
case smm_io:
@ -2250,7 +2250,7 @@ BEGIN:
goto BEGIN;
case smm_input:
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
#endif
case smm_string_input:
@ -2719,7 +2719,7 @@ ecl_make_stream_from_fd(cl_object fname, int fd, enum ecl_smmode smm)
case smm_output:
mode = "w";
break;
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
case smm_input_wsock:
case smm_output_wsock:
break;
@ -2727,7 +2727,7 @@ ecl_make_stream_from_fd(cl_object fname, int fd, enum ecl_smmode smm)
default:
FEerror("make_stream: wrong mode", 0);
}
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
if ( smm == smm_input_wsock || smm == smm_output_wsock )
fp = ( FILE* )fd;
else

View file

@ -415,7 +415,11 @@ cl__make_hash_table(cl_object test, cl_object size, cl_object rehash_size,
h->hash.lockable = !Null(lockable);
#ifdef ECL_THREADS
if (h->hash.lockable)
#if defined(_MSC_VER) || defined(mingw32)
h->hash.lock = CreateMutex(NULL, FALSE, NULL);
#else
pthread_mutex_init(&h->hash.lock, NULL);
#endif
#endif
return cl_clrhash(h);
}

View file

@ -233,6 +233,7 @@ GO_ON:
output = Cnil;
OUTPUT:
#ifdef ECL_THREADS
(void)0; /* MSVC complains about missing ';' before '}' */
} CL_UNWIND_PROTECT_EXIT {
mp_giveup_lock(symbol_value(@'mp::+load-compile-lock+'));
} CL_UNWIND_PROTECT_END;

View file

@ -142,8 +142,8 @@ make_package(cl_object name, cl_object nicknames, cl_object use_list)
x->pack.external = make_package_hashtable();
x->pack.name = name;
#ifdef ECL_THREADS
#if 0
pthread_mutex_init(&x->pack.lock);
#if defined(_MSC_VER) || defined(mingw32)
x->pack.lock = CreateMutex(NULL, FALSE, NULL);
#else
{
pthread_mutexattr_t attr;
@ -152,7 +152,7 @@ make_package(cl_object name, cl_object nicknames, cl_object use_list)
pthread_mutex_init(&x->pack.lock, &attr);
pthread_mutexattr_destroy(&attr);
}
#endif
#endif /* _MSC_VER */
#endif
INTERN:
x->pack.nicknames = Cnil;
@ -291,7 +291,7 @@ intern(cl_object name, cl_object p, int *intern_flag)
assert_type_string(name);
p = si_coerce_to_package(p);
TRY_AGAIN:
TRY_AGAIN_LABEL:
PACKAGE_LOCK(p);
s = gethash_safe(name, p->pack.external, OBJNULL);
if (s != OBJNULL) {
@ -317,7 +317,7 @@ intern(cl_object name, cl_object p, int *intern_flag)
PACKAGE_UNLOCK(p);
CEpackage_error("Cannot intern symbol ~S in locked package ~S.",
"Ignore lock and proceed", p, 2, name, p);
goto TRY_AGAIN;
goto TRY_AGAIN_LABEL;
}
s = make_symbol(name);
s->symbol.hpack = p;
@ -390,7 +390,7 @@ unintern(cl_object s, cl_object p)
assert_type_symbol(s);
p = si_coerce_to_package(p);
TRY_AGAIN:
TRY_AGAIN_LABEL:
PACKAGE_LOCK(p);
hash = p->pack.internal;
x = gethash_safe(s->symbol.name, hash, OBJNULL);
@ -405,7 +405,7 @@ unintern(cl_object s, cl_object p)
PACKAGE_UNLOCK(p);
CEpackage_error("Cannot unintern symbol ~S from locked package ~S.",
"Ignore lock and proceed", p, 2, s, p);
goto TRY_AGAIN;
goto TRY_AGAIN_LABEL;
}
if (!member_eq(s, p->pack.shadowings))
goto NOT_SHADOW;

View file

@ -1878,7 +1878,7 @@ read_VV(cl_object block, void (*entry_point)(cl_object))
#else
VV = block->cblock.data;
#endif
if ((len == 0) || (block->cblock.data_text == 0)) goto NO_DATA;
if ((len == 0) || (block->cblock.data_text == 0)) goto NO_DATA_LABEL;
/* Read all data for the library */
in=make_string_input_stream(make_constant_string(block->cblock.data_text),
@ -1903,7 +1903,7 @@ read_VV(cl_object block, void (*entry_point)(cl_object))
bds_unwind_n(6);
if (i < len)
FEreader_error("Not enough data while loading binary file", in, 0);
NO_DATA:
NO_DATA_LABEL:
/* Execute top-level code */
(*entry_point)(MAKE_FIXNUM(0));
x = cl_core.packages_to_be_created;

View file

@ -16,7 +16,7 @@
#include <sys/types.h>
#include <errno.h>
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(mingw32)
#include <winsock2.h>
#else
#include <netinet/in.h>
@ -26,7 +26,7 @@
#endif
#include <string.h>
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(mingw32)
#include <io.h>
#else
#include <sys/ioctl.h>
@ -39,7 +39,7 @@
extern int errno;
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(mingw32)
WSADATA wsadata;
int wsock_initialized = 0;
#define INIT_TCP \
@ -57,7 +57,7 @@ int wsock_initialized = 0;
void
ecl_tcp_close_all(void)
{
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(mingw32)
if ( wsock_initialized )
{
WSACleanup();
@ -99,7 +99,7 @@ int connect_to_server(char *host, int port)
/* Check the address type for an internet host. */
if (host_ptr->h_addrtype != AF_INET) {
/* Not an Internet host! */
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(mingw32)
errno = WSAEPROTOTYPE;
#else
errno = EPROTOTYPE;
@ -126,7 +126,7 @@ int connect_to_server(char *host, int port)
#ifdef TCP_NODELAY
/* make sure to turn off TCP coalescence */
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(mingw32)
{ char mi;
setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &mi, sizeof (char));
}
@ -177,7 +177,7 @@ create_server_port(int port)
#ifdef SO_REUSEADDR
/* Necesary to restart the server without a reboot */
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(mingw32)
{
char one = 1;
setsockopt(request, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(char));
@ -191,7 +191,7 @@ create_server_port(int port)
#endif /* SO_REUSEADDR */
#ifdef TCP_NODELAY
/* make sure to turn off TCP coalescence */
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(mingw32)
{ char mi;
setsockopt(request, IPPROTO_TCP, TCP_NODELAY, &mi, sizeof (char));
}
@ -205,7 +205,7 @@ create_server_port(int port)
/* Set up the socket data. */
memset((char *)&inaddr, 0, sizeof(inaddr));
inaddr.sin_family = AF_INET;
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(mingw32)
inaddr.sin_port = htons((unsigned short)port);
#else
inaddr.sin_port = htons(port);
@ -284,7 +284,7 @@ si_open_client_stream(cl_object host, cl_object port)
if (fd == 0)
@(return Cnil)
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(mingw32)
streamIn = ecl_make_stream_from_fd(host, fd, smm_input_wsock);
streamOut = ecl_make_stream_from_fd(host, fd, smm_output_wsock);
#else
@ -323,7 +323,7 @@ si_open_server_stream(cl_object port)
cl_object
si_open_unix_socket_stream(cl_object path)
{
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(mingw32)
FEerror("UNIX socket not supported under Win32 platform", 0);
#else
int fd; /* file descriptor */

View file

@ -11,6 +11,9 @@
See file '../Copyright' for full details.
*/
/*
* IMPORTANT!!!! IF YOU EDIT THIS FILE, CHANGE ALSO threads_win32.d
*/
#include <pthread.h>
#include <signal.h>

View file

@ -25,7 +25,7 @@
#include <unistd.h>
#endif
#ifdef mignw32
#if defined(mignw32) || defined(_MSC_VER)
/* The function sleep() in MinGW is bogus: it counts millisecons! */
#include <winbase.h>
#define sleep(x) Sleep(x*1000)

View file

@ -17,13 +17,11 @@
#include "ecl.h"
#include "internal.h"
#include <signal.h>
#ifndef _MSC_VER
#include <unistd.h>
#else
#include <windows.h>
#if defined(mingw32) || defined(_MSC_VER)
# include <windows.h>
#endif
#ifdef ECL_THREADS
#include <pthread.h>
#if !defined(_MSC_VER)
# include <unistd.h>
#endif
/******************************* ------- ******************************/
@ -34,7 +32,7 @@ static void
handle_signal(int sig)
{
switch (sig) {
#ifdef ECL_THREADS
#if defined(ECL_THREADS) && !defined(_MSC_VER) && !defined(mingw32)
case SIGUSR1:
funcall(1, cl_env.own_process->process.interrupt);
break;
@ -189,7 +187,7 @@ init_unixint(void)
{
signal(SIGFPE, signal_catcher);
signal(SIGINT, signal_catcher);
#ifdef ECL_THREADS
#if defined(ECL_THREADS) && !defined(_MSC_VER) && !defined(mingw32)
signal(SIGUSR1, signal_catcher);
#endif
#ifdef _MSC_VER

View file

@ -869,8 +869,8 @@ by every function, which attempts to generate RENDER requests."
;; $Log$
;; Revision 1.8 2005-01-14 12:25:04 jjgarcia
;; Some files were not comitted in the last revision
;; Revision 1.9 2005-01-31 18:00:14 jjgarcia
;; Thread support for Mingw32
;;
;; Revision 1.1 2004/06/10 07:59:31 jlr
;; Portable CLX library imported

View file

@ -95,7 +95,7 @@ ranlib ../@LIBPREFIX@ecl.@LIBEXT@'")
;;; We do not need the -rpath flag for the library, nor -lecl.
;;;
(let ((c::*ld-shared-flags* #-msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @STATICLIBS@ @CLIBS@"
#+msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @STATICLIBS@ @CLIBS@ /DEF:ecl.def")
#+msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @STATICLIBS@ @CLIBS@ /DEF:@DEF@")
(c::*cc-flags* (concatenate 'string "-I@true_builddir@/c " c::*cc-flags*)))
(c::shared-cc (compile-file-pathname "ecl" :type :dll)
"c/main.@OBJEXT@"

1366
src/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -261,12 +261,13 @@ if test "${locative}" ; then
fi
AC_MSG_CHECKING(for threads support)
if test "${threads}" ; then
if test -z "${THREAD_LDFLAGS}"; then
if test -z "${THREAD_OBJ}"; then
gc_flags="${gc_flags} --disable-threads"
threads='';
AC_MSG_RESULT(no)
else
EXTRA_OBJS="${EXTRA_OBJS} threads.${OBJEXT}"
gc_flags="${gc_flags} ${THREAD_GC_FLAGS}"
EXTRA_OBJS="${EXTRA_OBJS} ${THREAD_OBJ}.${OBJEXT}"
CLIBS="${THREAD_LDFLAGS} ${CLIBS}"
CFLAGS="${CFLAGS} ${THREAD_CFLAGS}"
AC_DEFINE(ECL_THREADS)
@ -274,6 +275,7 @@ if test "${threads}" ; then
fi
else
AC_MSG_RESULT(disabled)
gc_flags="${gc_flags} --disable-threads"
fi
if test ${usecxx} = "no" ; then
ECL_CC="${CC}"
@ -373,7 +375,7 @@ elif test "${local_boehm}" = "no" ; then
test -d gc && rm -rf gc
if mkdir gc; then
(destdir=`${PWDCMD}`; cd gc; CC="${CC} ${PICFLAG}" \
$srcdir/gc/configure --disable-threads --disable-shared --prefix=${destdir} \
$srcdir/gc/configure --disable-shared --prefix=${destdir} \
--includedir=${destdir}/h --libdir=${destdir} --build=${build_alias} \
--host=${host_alias} ${gc_flags})
fi

View file

@ -30,6 +30,9 @@
/* Network streams */
#undef TCP
#if defined(TCP) && (defined(_MSC_VER) || defined(mingw32))
# define ECL_WSOCK
#endif
/* Foreign functions interface */
#undef ECL_FFI

View file

@ -30,18 +30,28 @@ typedef short int16_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
#endif
#include <config.h>
#include <gmp.h>
#include <object.h>
#include <stacks.h>
#ifdef ECL_THREADS
# include <pthread.h>
# if defined(_MSC_VER) || defined(mingw32)
# include <windows.h>
typedef HANDLE pthread_t;
typedef HANDLE pthread_mutex_t;
# undef ERROR
# else
# include <pthread.h>
# endif
# define start_critical_section()
# define end_critical_section()
#else
# define start_critical_section()
# define end_critical_section()
#endif
#include <gmp.h>
#include <object.h>
#include <stacks.h>
#include <external.h>
#include <eval.h>
#include <number.h>

View file

@ -23,7 +23,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <setjmp.h>
#include "config.h"
#if !defined(cygwin) && !defined(_MSC_VER)
#include <inttypes.h>
#endif
@ -33,17 +32,28 @@ typedef short int16_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
#endif
#include <gmp.h>
#include <object.h>
#include <stacks.h>
#include <config.h>
#ifdef ECL_THREADS
# include <pthread.h>
# if defined(_MSC_VER) || defined(mingw32)
# include <windows.h>
typedef HANDLE pthread_t;
typedef HANDLE pthread_mutex_t;
# undef ERROR
# else
# include <pthread.h>
# endif
# define start_critical_section()
# define end_critical_section()
#else
# define start_critical_section()
# define end_critical_section()
#endif
#include <gmp.h>
#include <object.h>
#include <stacks.h>
#ifndef _ARGS
# define _ARGS(x) x
#endif

View file

@ -129,33 +129,27 @@ extern void cl_write_object(cl_object x, cl_object stream);
/* global locks */
#ifdef ECL_THREADS
#if 0
#define HASH_TABLE_LOCK(h) if ((h)->hash.lockable) pthread_mutex_lock(&(h)->hash.lock)
#define HASH_TABLE_UNLOCK(h) if ((h)->hash.lockable) pthread_mutex_unlock(&(h)->hash.lock)
#define PACKAGE_LOCK(p) pthread_mutex_lock(&(p)->pack.lock)
#define PACKAGE_UNLOCK(p) pthread_mutex_unlock(&(p)->pack.lock)
#define PACKAGE_OP_LOCK() pthread_mutex_lock(&cl_core.global_lock)
#define PACKAGE_OP_UNLOCK() pthread_mutex_unlock(&cl_core.global_lock)
#define THREAD_OP_LOCK() pthread_mutex_lock(&cl_core.global_lock)
#define THREAD_OP_UNLOCK() pthread_mutex_unlock(&cl_core.global_lock)
# if defined(_MSC_VER) || defined(mingw32)
# define pthread_mutex_lock(x) \
(WaitForSingleObject(*(HANDLE*)(x), INFINITE) != WAIT_OBJECT_0)
# define pthread_mutex_unlock(x) (ReleaseMutex(*(HANDLE*)(x)) == 0)
# endif
# define HASH_TABLE_LOCK(h) if ((h)->hash.lockable) if (pthread_mutex_lock(&(h)->hash.lock)) internal_error("")
# define PACKAGE_LOCK(p) if (pthread_mutex_lock(&(p)->pack.lock)) internal_error("")
# define PACKAGE_OP_LOCK() if (pthread_mutex_lock(&cl_core.global_lock)) internal_error("")
# define THREAD_OP_LOCK() if (pthread_mutex_lock(&cl_core.global_lock)) internal_error("")
# define HASH_TABLE_UNLOCK(h) if ((h)->hash.lockable) if (pthread_mutex_unlock(&(h)->hash.lock)) internal_error("")
# define PACKAGE_UNLOCK(p) if (pthread_mutex_unlock(&(p)->pack.lock)) internal_error("")
# define PACKAGE_OP_UNLOCK() if (pthread_mutex_unlock(&cl_core.global_lock)) internal_error("")
# define THREAD_OP_UNLOCK() if (pthread_mutex_unlock(&cl_core.global_lock)) internal_error("")
#else
#define HASH_TABLE_LOCK(h) if ((h)->hash.lockable) if (pthread_mutex_lock(&(h)->hash.lock)) internal_error("")
#define PACKAGE_LOCK(p) if (pthread_mutex_lock(&(p)->pack.lock)) internal_error("")
#define PACKAGE_OP_LOCK() if (pthread_mutex_lock(&cl_core.global_lock)) internal_error("")
#define THREAD_OP_LOCK() if (pthread_mutex_lock(&cl_core.global_lock)) internal_error("")
#define HASH_TABLE_UNLOCK(h) if ((h)->hash.lockable) if (pthread_mutex_unlock(&(h)->hash.lock)) internal_error("")
#define PACKAGE_UNLOCK(p) if (pthread_mutex_unlock(&(p)->pack.lock)) internal_error("")
#define PACKAGE_OP_UNLOCK() if (pthread_mutex_unlock(&cl_core.global_lock)) internal_error("")
#define THREAD_OP_UNLOCK() if (pthread_mutex_unlock(&cl_core.global_lock)) internal_error("")
#endif
#else
#define HASH_TABLE_LOCK(h)
#define HASH_TABLE_UNLOCK(h)
#define PACKAGE_LOCK(p)
#define PACKAGE_UNLOCK(p)
#define PACKAGE_OP_LOCK()
#define PACKAGE_OP_UNLOCK()
#endif
# define HASH_TABLE_LOCK(h)
# define HASH_TABLE_UNLOCK(h)
# define PACKAGE_LOCK(p)
# define PACKAGE_UNLOCK(p)
# define PACKAGE_OP_LOCK()
# define PACKAGE_OP_UNLOCK()
#endif /* ECL_THREADS */
/* read.d */

View file

@ -295,7 +295,7 @@ enum ecl_smmode { /* stream mode */
smm_string_input, /* string input */
smm_string_output, /* string output */
smm_probe /* probe (only used in open_stream()) */
#ifdef _MSC_VER
#if defined(ECL_WSOCK)
,
smm_input_wsock, /* input socket (Win32) */
smm_output_wsock /* output socket (Win32) */