diff options
author | Dick Porter <dick@acm.org> | 2001-09-21 16:42:33 +0400 |
---|---|---|
committer | Dick Porter <dick@acm.org> | 2001-09-21 16:42:33 +0400 |
commit | 93783298802561dbd4c34f20cca48e5e502c3312 (patch) | |
tree | 11636ed68b0b951943b20ffdc3efab7144ebdaa2 | |
parent | f8906a560557c1b50416be779f20259112ce7dfd (diff) |
2001-09-21 Dick Porter <dick@ximian.com>
* threads-pthread.h:
* threads-pthread.c: New file, for handling pthreads-style
threading support. Start() now starts a new thread and executes
the ThreadStart delegate instance.
* icall.c: Added the internalcall for
System.Threading.Thread::Start_internal
* Makefile.am: Added new files, and PTHREADS_LIBS to the link line
2001-09-21 Dick Porter <dick@ximian.com>
* Makefile.am (testjit_LDADD): Added PTHREAD_LIBS to the link line
2001-09-21 Dick Porter <dick@ximian.com>
* Makefile.am (mint_LDADD): Added PTHREAD_LIBS to the link line
2001-09-21 Dick Porter <dick@ximian.com>
* configure.in: Check for libpthread
svn path=/trunk/mono/; revision=914
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | configure.in | 7 | ||||
-rw-r--r-- | mono/interpreter/ChangeLog | 3 | ||||
-rw-r--r-- | mono/interpreter/Makefile.am | 1 | ||||
-rw-r--r-- | mono/jit/ChangeLog | 4 | ||||
-rw-r--r-- | mono/jit/Makefile.am | 1 | ||||
-rw-r--r-- | mono/metadata/ChangeLog | 11 | ||||
-rw-r--r-- | mono/metadata/Makefile.am | 8 | ||||
-rw-r--r-- | mono/metadata/icall.c | 6 | ||||
-rw-r--r-- | mono/metadata/threads-pthread.c | 46 | ||||
-rw-r--r-- | mono/metadata/threads-pthread.h | 19 |
11 files changed, 108 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 08db86da856..9fb4a2354a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2001-09-21 Dick Porter <dick@ximian.com> + + * configure.in: Check for libpthread + 2001-09-19 Dietmar Maurer <dietmar@ximian.com> * mono/tests/test-ops.cs: added more tests diff --git a/configure.in b/configure.in index 63b1db614b2..45c570df08a 100644 --- a/configure.in +++ b/configure.in @@ -33,6 +33,13 @@ GMODULE_LIBS=`glib-config --libs gmodule` AC_SUBST(GMODULE_CFLAGS) AC_SUBST(GMODULE_LIBS) +dnl ***************************** +dnl *** Checks for libpthread *** +dnl ***************************** +AC_CHECK_LIB(pthread,pthread_create,PTHREAD_LIBS=-lpthread, + AC_MSG_ERROR([Cannot find libpthread])) +AC_SUBST(PTHREAD_LIBS) + CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations' TARGET="unknown" diff --git a/mono/interpreter/ChangeLog b/mono/interpreter/ChangeLog index 2016663d180..9d92fa3b64c 100644 --- a/mono/interpreter/ChangeLog +++ b/mono/interpreter/ChangeLog @@ -1,3 +1,6 @@ +2001-09-21 Dick Porter <dick@ximian.com> + + * Makefile.am (mint_LDADD): Added PTHREAD_LIBS to the link line Thu Sep 20 16:32:42 CEST 2001 Paolo Molaro <lupus@ximian.com> diff --git a/mono/interpreter/Makefile.am b/mono/interpreter/Makefile.am index b1a2df58a93..e173fb150ed 100644 --- a/mono/interpreter/Makefile.am +++ b/mono/interpreter/Makefile.am @@ -15,6 +15,7 @@ mint_LDADD = \ ../metadata/libmetadata.a \ $(GLIB_LIBS) \ $(GMODULE_LIBS) \ + $(PTHREAD_LIBS) \ -lm man_MANS = mint.1 diff --git a/mono/jit/ChangeLog b/mono/jit/ChangeLog index 33e58c406c5..5c647ae6ddf 100644 --- a/mono/jit/ChangeLog +++ b/mono/jit/ChangeLog @@ -1,3 +1,7 @@ +2001-09-21 Dick Porter <dick@ximian.com> + + * Makefile.am (testjit_LDADD): Added PTHREAD_LIBS to the link line + 2001-09-21 Dietmar Maurer <dietmar@ximian.com> * x86.brg: implemented long MUL/DIV diff --git a/mono/jit/Makefile.am b/mono/jit/Makefile.am index dd2040ffae3..e446b8d21b7 100644 --- a/mono/jit/Makefile.am +++ b/mono/jit/Makefile.am @@ -19,6 +19,7 @@ testjit_LDADD = \ ../metadata/libmetadata.a \ $(GLIB_LIBS) \ $(GMODULE_LIBS) \ + $(PTHREAD_LIBS) \ -lm codegen-x86.c codegen.h: x86.brg diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog index fe279fb6065..79d9f315b82 100644 --- a/mono/metadata/ChangeLog +++ b/mono/metadata/ChangeLog @@ -1,3 +1,14 @@ +2001-09-21 Dick Porter <dick@ximian.com> + + * threads-pthread.h: + * threads-pthread.c: New file, for handling pthreads-style + threading support. Start() now starts a new thread and executes + the ThreadStart delegate instance. + + * icall.c: Added the internalcall for + System.Threading.Thread::Start_internal + + * Makefile.am: Added new files, and PTHREADS_LIBS to the link line Thu Sep 20 19:37:39 CEST 2001 Paolo Molaro <lupus@ximian.com> diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am index b897f838ada..c3641d1ede9 100644 --- a/mono/metadata/Makefile.am +++ b/mono/metadata/Makefile.am @@ -20,7 +20,10 @@ libmetadata_a_SOURCES = \ loader.c \ class.c \ object.c \ - icall.c + icall.c \ + threads-pthread.c \ + threads-pthread.h \ + # libmetadataincludedir = $(includedir)/mono/metadata @@ -42,5 +45,6 @@ libmetadatainclude_HEADERS = \ pedump_SOURCES = \ pedump.c $(libmetadata_a_SOURCES) -pedump_LDADD = $(GLIB_LIBS) $(GMODULE_LIBS) +pedump_LDADD = $(GLIB_LIBS) $(GMODULE_LIBS) $(PTHREAD_LIBS) + diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c index f7206b3b06a..0b4078f3998 100644 --- a/mono/metadata/icall.c +++ b/mono/metadata/icall.c @@ -12,6 +12,7 @@ #include <stdarg.h> #include <mono/metadata/object.h> +#include <mono/metadata/threads-pthread.h> static MonoObject * ves_icall_System_Array_GetValue (MonoObject *this, MonoObject *idxs) @@ -200,6 +201,11 @@ static gpointer icall_map [] = { "System.Object::MemberwiseClone", ves_icall_System_Object_MemberwiseClone, /* + * System.Threading + */ + "System.Threading.Thread::Start_internal", ves_icall_System_Threading_Thread_Start_internal, + + /* * add other internal calls here */ NULL, NULL diff --git a/mono/metadata/threads-pthread.c b/mono/metadata/threads-pthread.c new file mode 100644 index 00000000000..b77b5b124b8 --- /dev/null +++ b/mono/metadata/threads-pthread.c @@ -0,0 +1,46 @@ +/* + * threads-pthread.c: System-specific thread support + * + * Author: + * Dick Porter (dick@ximian.com) + * + * (C) 2001 Ximian, Inc. + */ + +#include <config.h> +#include <glib.h> +#include <string.h> +#include <pthread.h> + +#include <mono/metadata/object.h> +#include <mono/metadata/threads-pthread.h> + +pthread_t ves_icall_System_Threading_Thread_Start_internal(MonoObject *this, + MonoObject *start) +{ + pthread_t tid; + MonoClassField *field; + void *(*start_func)(void *); + int ret; + + g_message("Trying to start a new thread: this (%p) start (%p)", + this, start); + + field=mono_class_get_field_from_name(mono_defaults.delegate_class, "method_ptr"); + start_func= *(gpointer *)(((char *)start) + field->offset); + + if(start_func==NULL) { + g_warning("Can't locate start method!"); + /* Not sure if 0 can't be a valid pthread_t */ + return(0); + } else { + ret=pthread_create(&tid, NULL, start_func, NULL); + if(ret!=0) { + g_warning("pthread_create error: %s", strerror(ret)); + return(0); + } + + g_message("Started thread ID %ld", tid); + return(tid); + } +} diff --git a/mono/metadata/threads-pthread.h b/mono/metadata/threads-pthread.h new file mode 100644 index 00000000000..b0110e9ff1e --- /dev/null +++ b/mono/metadata/threads-pthread.h @@ -0,0 +1,19 @@ +/* + * threads-pthread.h: System-specific thread support + * + * Author: + * Dick Porter (dick@ximian.com) + * + * (C) 2001 Ximian, Inc. + */ + +#ifndef _MONO_METADATA_THREAD_PTHREAD_H_ +#define _MONO_METADATA_THREAD_PTHREAD_H_ + +#include <pthread.h> + +#include <mono/metadata/object.h> + +extern pthread_t ves_icall_System_Threading_Thread_Start_internal(MonoObject *this, MonoObject *start); + +#endif /* _MONO_METADATA_THREAD_PTHREAD_H_ */ |