Commit Graph
189 Commits
Author SHA1 Message Date
Marek Safar 4b4ddb66b3 [corlib] Improve flow of ExecutionContext (few tests taken from https://github.com/mono/mono/pull/864). Fixes #18121 and similar. 2014-03-06 19:54:06 +01:00
Marek Safar 9cbe9c372b [corlib] Seal InternalThread 2014-03-04 10:17:30 +01:00
Rodrigo Kumpera cff7efdb32 [runtime] Use the system limit when enforcing a new thread stack size. Fixes #17908. 2014-02-20 15:04:18 -05:00
Zoltan Varga 6d95657a21 [corlib] Remove the stack size limit check from CheckStackSize (), it should be possible to create larger stacks than the default. Fixes #17908. 2014-02-20 12:12:31 -05:00
Rodrigo Kumpera 349cb638ff [bcl] Implement CultureInfo.DefaultThreadCurrentUICulture. 2013-11-18 18:13:03 -05:00
Rodrigo Kumpera 5b8f9ad666 [bcl] Implement CultureInfo.DefaultThreadCurrentCulture.
The way DefaultThreadCurrentCulture is to be implemented is that its current value
will always be used by a thread that didn't set a value for its culture.

This means we can't cache DefaultThreadCurrentCulture value as it's allowed to
change and threads must always show the latest value.
2013-11-18 18:13:02 -05:00
Rodrigo Kumpera e499793125 [bcl]Set the culture of the thread local NumberFormatter everytime.
the problem of changing the culture when a new value is set in the current thread
is that is doesn't work well with CultureInfo.DefaultThreadCurrentCulture.
2013-11-18 18:13:02 -05:00
Alistair Leslie-Hughes ccbc9e3a8f Correct TrySetApartmentstate tests
License: This patch is under the MIT/X11 license.
2013-07-24 14:27:56 +10:00
Alistair Leslie-Hughes 070c3abecf Allow TrySetApartmentState to set the same state multiple times.
License: This patch is under the MIT/X11 license.
2013-07-17 15:22:54 +10:00
Sebastien Pouliot 68ebec2787 Remove MonoTouch specific code that is now handled without reflection 2013-03-12 16:04:43 -04:00
Marek Safar 7c704df8ae Move rarely used NamedDataSlot to its own type to cut few dependencies 2013-03-08 17:40:03 +01:00
Marek Safar b26fc714dd Manually remove code which is disabled but compiler cannot remove automatically. 2013-03-04 09:14:08 +01:00
Rodrigo Kumpera 07a220c61c Mobile should not have the COM types set. 2013-03-01 18:58:35 -05:00
Marek Safar bb05074a9f Replace some hashtables with dictionaries 2013-02-27 22:58:32 +01:00
Rodrigo Kumpera 1b92a4148c Since MOBILE implies NET_4_* now, take this into account and simplify our ifdefs. 2013-02-11 18:42:18 -05:00
Rodrigo Kumpera b96d05dac3 Kill the MOONLIGHT define in corlib. 2013-02-11 16:03:28 -05:00
Zoltan Varga 1b0326d73f Clean up the InternalThread structure. Synchronize fields between the managed and unmanaged versions, group reference fields together near the beginning. 2012-10-05 14:29:37 +02:00
Rodrigo Kumpera 70ac21baef New field InternalThread::ignore_next_signal. Bump corlib version due to layout change. 2012-06-27 19:59:54 -03:00
Marek Safar 9696a57e64 Add Environment::CurrentManagedThreadId 2012-06-21 15:38:45 +01:00
Miguel de Icaza ae0feab435 Removal of NET_1_1 defines and some NET_2_0; Both defines are true these days in Mono, no versions prior to 2.0 are supported 2012-06-01 18:04:24 -04:00
Sebastien Pouliot 1eb623e07a Thread.Finalize is needed in Profile3 of the Portable Class Libraries. 2012-05-09 14:36:21 -04:00
Rodrigo Kumpera 83dccf8fe7 Add all missing sequential layout directives to corlib and system. 2011-12-13 11:57:23 -02:00
Sebastien Pouliot e37850a605 Ensure that [Parameterized]ThreadStart code is always wrapped in a NSAutoreleasePool for MonoTouch. Fix bug #1999 2011-11-29 19:54:44 -05:00
Jb Evain 7a015c0ba8 Fix non net_4_0 profiles build 2011-05-02 11:57:40 +02:00
Jb Evain 4986f4409e Properly check the maxstacksize asked for the Thread 2011-05-02 11:42:48 +02:00
Rolf Bjarne Kvinge f26a050098 [corlib] Ensure Thread.ManagedThreadId is unique per thread.
This fixes bug #667329.

The problem was that ManagedThreadId was created from a per-appdomain
counter, but stored in a per-thread storage, so if two threads could
end up with the same ManagedThreadId if a second appdomain executed
on the second thread first.
2011-04-15 14:56:21 +02:00
Rodrigo Kumpera b998e8e943 Move thread management from sgen to utils. Move smr from MonoInternalThread to thread_info.
* mono-threads.c: An implementation of low level thread management that
	fits what sgen needs. It uses hazard pointers to manage the thread list
	since we can't protect it with the GC lock as this would cause boehm to
	deadlock. This requires us to move small_id one layer down.

	* Thread.cs:
	* object-internals.h:
	* threads.c: Small id is now stored on MonoThreadInfo so it can be
	used by lower layers of the runtime such as sgen.

	* sgen-major-copying.c:
	* sgen-os-mach.c:
	* sgen-os-posix.c:
	* sgen-gc.h:
	* sgen-gc.c: Replace sgen's thread management code with
	the new one.

	* boehm-gc.c: Hookup the new thread management code. Boehm's
	own management code is not been replaced as I'm too much of
	a coward to mess with it.

	* hazard-pointer.c: Adjust to the new location of small_id.
2011-04-07 21:12:10 -03:00
Marek Safar eda489c823 Few 4.0 profile corcompare changes 2011-03-30 18:25:03 +01:00
Paolo Molaro b795fe8f87 Implemented fast version of ThreadLocal<T>.
This patchset implements a fast version of ThreadLocal<T> by reusing the code from
the implementation of the ThreadStatic attribute. The tls slots are cleaned up
on Dispose (or Finalize) instead of during appdomain shutdown.
Since C# doesn't allow us to define an icall that returns a T& or a T* type, a JIT
hack is used: every load field address instruction for the tlsdata field in
ThreadLocal<T> is intercepted and trasformed into a tls access by using the tls_offset
field from the same ThreadLocal<T> instance. So, while the C# code looks like
it accesses and changes an instance field, under the hood it will access the tls
storage.
The end result is that this is 5-6 times faster than the previous code, 10-15%
faster than using Thread.GetData () (when used with references).
This implementation also fixes a number of issues with disposing and with
per-thread initializers throwing an exception.
2011-03-01 16:43:48 +01:00
Rodrigo Kumpera fee645b660 Make maxStackSize behavior compatible with MS.
* Thread.cs (.ctor): Check if maxStackSize is negative
	and raise and AOORE. Silently use a saner minimum size
	of 128k as mono can't really run with much less than that.
2011-02-11 14:56:58 +01:00
Gonzalo Paniagua Javier d84abdc22a Move some code into their own methods. 2011-02-09 18:09:03 -05:00
Gonzalo Paniagua Javier df5d05c37f Attempt 1 2011-02-09 12:04:56 -05:00
Geoff Norton 83e999b7d7 Add pfx to the mobile profile 2011-01-25 01:51:17 -05:00
Marek Safar d84d7c7eb9 Remove no longer used BOOTSTRAP conditionals 2010-12-29 12:41:12 +00:00
Rodrigo Kumpera 9d15836e9e Fix corlib regression 2010-11-27 03:20:29 -02:00
Rodrigo Kumpera 0a609bf3de Move culture handling to Thread from InternalThread.
* Thread.cs: Move culture data from InternalThread to Thread
	and thus completely avoid the whole caching and serialization
	nightmare. Even thou this is a cleanup it should speed up
	multi-appdomain setups.

	* threads.c: Remove culture caching machinery.

	* icall-def.h: Ditto.

	Fixes #318750 as a byproduct.
2010-11-27 02:56:37 -02:00
Zoltan Varga 150aa825d5 Fix the previous change. 2010-11-09 20:00:23 +01:00
Zoltan Varga 8e0d6b1111 Speed up Thread.ManagedThreadId. 2010-11-09 19:53:05 +01:00
Jérémie Laval 0856ee3930 Add Yield method to Thread (4.0 profile).
Yield is an internal call that simply calls wapi SwitchToThread function.
On !Windows system, this functions use POSIX sched_yield function.
2010-07-29 11:49:55 +02:00
Jb Evain ba09e4ba86 use MOONLIGHT symbol
svn path=/trunk/mcs/; revision=153658
2010-03-16 12:11:37 +00:00
Marek Safar 3086e99d75 Warnings cleanup
svn path=/trunk/mcs/; revision=146142
2009-11-13 14:52:59 +00:00
Miguel de Icaza 7f825c2dbe More NET_2_0 removal
svn path=/trunk/mcs/; revision=145236
2009-11-03 01:08:45 +00:00
Miguel de Icaza 5e63701d4b 2009-11-02 Miguel de Icaza <[email protected]>
* Jumbo patch to drop support for pre-NET_2_0 code:

        Remove ONLY_1_1 code
        Remove NET_1_0 only code
        Remove NET_2_0 defines assuming the value is true.


svn path=/trunk/mcs/; revision=145230
2009-11-02 23:22:40 +00:00
Sebastien Pouliot ccffcae90d 2009-11-02 Sebastien Pouliot <[email protected]>
* Thread.cs (set_CurrentUICulture): Delay setting in_currentculture
	to true until after the null check and the return statement.


svn path=/trunk/mcs/; revision=145214
2009-11-02 20:05:35 +00:00
Sebastien Pouliot b6a5bb1207 In System.Threading:
2009-10-25  Sebastien Pouliot  <[email protected]>

	* Thread.cs: Fix validations for Join and Sleep overloads

In Test/System.Threading:
2009-10-25  Sebastien Pouliot  <[email protected]>

	* ThreadTest.cs: Add test cases for Current[UI]Culture (not 
	working), Name, Join, Sleep and SpinWait


svn path=/trunk/mcs/; revision=144824
2009-10-25 16:41:18 +00:00
Jb Evain d40cd894df 2009-10-20 Jb Evain <[email protected]>
* Thread.cs: change type of the current_appcontext field to object
	to avoid triggering static constructors unless explicitely required.


svn path=/trunk/mcs/; revision=144431
2009-10-20 09:03:19 +00:00
Geoff Norton 88026a47b4 fix MONOTOUCH on trunk
svn path=/trunk/mcs/; revision=144133
2009-10-14 18:49:14 +00:00
Sebastien Pouliot c85fce7f73 2009-10-07 Sebastien Pouliot <[email protected]>
* Thread.cs: Remove LocalDataStoreSlot-related methods from
	Moonlight build


svn path=/trunk/mcs/; revision=143629
2009-10-07 12:31:16 +00:00
Mark Probst 1d313a8230 2009-09-30 Mark Probst <[email protected]>
* Thread.cs: Remove serialized culture icall stuff from
	InternalThread.  Implement it by using the cross-domain byte array
	transfer icalls.

	* Environment.cs: Corlib version bump.

svn path=/trunk/mcs/; revision=143040
2009-09-30 16:09:56 +00:00
Rolf Bjarne Kvinge 2994492806 2009-09-29 Rolf Bjarne Kvinge <[email protected]>
* Thread.cs: StartSafe: ignore ThreadAbortExceptions.

svn path=/trunk/mcs/; revision=142847
2009-09-29 10:59:54 +00:00