[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h, 1.79, 1.80 int_table
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h, 1.79, 1.80 int_table.c, 1.82, 1.83 lib_thread.c, 1.19, 1.20 |
Date: |
Sat, 23 Aug 2003 06:39:16 -0400 |
Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv7959/engine
Modified Files:
int_proto.h int_table.c lib_thread.c
Log Message:
Add the "Thread.SpinWait" interncall.
Index: int_proto.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_proto.h,v
retrieving revision 1.79
retrieving revision 1.80
diff -C2 -r1.79 -r1.80
*** int_proto.h 23 Aug 2003 01:47:27 -0000 1.79
--- int_proto.h 23 Aug 2003 10:39:13 -0000 1.80
***************
*** 222,225 ****
--- 222,229 ----
extern void _IL_Thread_InternalSetPriority(ILExecThread * _thread, ILObject *
_this, ILInt32 _p1);
extern ILBool _IL_Thread_CanStartThreads(ILExecThread * _thread);
+ extern void _IL_Thread_Interrupt(ILExecThread * _thread, ILObject * _this);
+ extern void _IL_Thread_Resume(ILExecThread * _thread, ILObject * _this);
+ extern void _IL_Thread_SpinWait(ILExecThread * _thread, ILInt32 _p1);
+ extern void _IL_Thread_Suspend(ILExecThread * _thread, ILObject * _this);
extern ILNativeInt _IL_WaitEvent_InternalCreateEvent(ILExecThread * _thread,
ILBool _p1, ILBool _p2);
Index: int_table.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_table.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -C2 -r1.82 -r1.83
*** int_table.c 23 Aug 2003 01:47:27 -0000 1.82
--- int_table.c 23 Aug 2003 10:39:13 -0000 1.83
***************
*** 1185,1188 ****
--- 1185,1192 ----
IL_METHOD("InternalSetPriority",
"(TvSystem.Threading.ThreadPriority;)V", _IL_Thread_InternalSetPriority,
marshal_vppi)
IL_METHOD("CanStartThreads", "()Z", _IL_Thread_CanStartThreads,
marshal_bp)
+ IL_METHOD("Interrupt", "(T)V", _IL_Thread_Interrupt, marshal_vpp)
+ IL_METHOD("Resume", "(T)V", _IL_Thread_Resume, marshal_vpp)
+ IL_METHOD("SpinWait", "(i)V", _IL_Thread_SpinWait, marshal_vpi)
+ IL_METHOD("Suspend", "(T)V", _IL_Thread_Suspend, marshal_vpp)
IL_METHOD_END
Index: lib_thread.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_thread.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** lib_thread.c 15 Jul 2003 22:17:33 -0000 1.19
--- lib_thread.c 23 Aug 2003 10:39:13 -0000 1.20
***************
*** 2,6 ****
* lib_thread.c - Internalcall methods for "System.Threading.*".
*
! * Copyright (C) 2001, 2002 Southern Storm Software, Pty Ltd.
*
* Contributions from Thong Nguyen <address@hidden>
--- 2,6 ----
* lib_thread.c - Internalcall methods for "System.Threading.*".
*
! * Copyright (C) 2001, 2002, 2003 Southern Storm Software, Pty Ltd.
*
* Contributions from Thong Nguyen <address@hidden>
***************
*** 23,26 ****
--- 23,32 ----
#include "engine.h"
#include "lib_defs.h"
+ #if HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #if HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
#ifdef __cplusplus
***************
*** 1032,1035 ****
--- 1038,1061 ----
{
ILThreadResume(((System_Thread *)_this)->privateData);
+ }
+
+ /*
+ * public static void SpinWait(int iterations);
+ */
+ void _IL_Thread_SpinWait(ILExecThread *_thread, ILInt32 iterations)
+ {
+ /* Convert the spin wait into a sleep request, because dead
+ loop spinning for a long time is not a very good idea under
+ multi-tasking operating systems. We pick an arbitrary
+ resolution of 1 iteration equal to 1 microsecond, which
+ will give some consistency across platforms */
+ if(iterations > 0)
+ {
+ #ifdef HAVE_USLEEP
+ usleep((unsigned long)(long)iterations);
+ #else
+ ILThreadSleep((ILUInt32)(ms / 1000));
+ #endif
+ }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h, 1.79, 1.80 int_table.c, 1.82, 1.83 lib_thread.c, 1.19, 1.20,
Rhys Weatherley <address@hidden> <=