[Mono-list] Mono and System.Threading.Parallel question

Andreas Färber andreas.faerber at web.de
Tue May 27 06:23:25 EDT 2008


Hello Andreea,

Am 25.05.2008 um 22:14 schrieb Tancu Andreea:

> I tried to add as a reference to my project the file  
> System.Concurrency-2007-12-23.dll found in the thread, but I am  
> obviously doing something wrong since I get the following error :
> "A reference to System.Concurency.dll could not be added. Please  
> make sure that the file is accessible, and that it is a valid  
> assembly or COM component."

The file you reference above is not an assembly (.dll) but rather a  
textual source code patch (.diff). Furthermore the System.Concurrency  
patch does not implement any functionality, and System.Concurrency is  
not System.Threading.Parallel.

My original System.Threading.Parallel patch is here:
http://lists.ximian.com/pipermail/mono-devel-list/2007-December/026088.html
(Note the "Name:" for the original file name.)

> I don't have my own implementation of System.Threading.Parallel, I  
> have a reference to System.Core and System.Threading in order to use  
> the Parallel.Do method.

System.Threading.Parallel does not offer Parallel.Do, that's  
Microsoft's System.Concurrency API.

> I also tried using the Intel's cli-parallel library, but I can't  
> compile due to the following errors:
>
> The type or namespace name 'AutoResetEvent' could not be found (are  
> you missing a using directive or an assembly reference?)
>
> The type or namespace name 'WaitCallback' could not be found (are  
> you missing a using directive or an assembly reference?)
>
> And after adding the using System.Threading directive i only get the  
> following error:
>
> "The name Threading does not exist in the current context" at the  
> line:
> if (Threading.Interlocked.Decrement(ref m_BusyCount) == 0)

I haven't looked at the code or used it myself, so I don't know how to  
use it.


> I added in the Mono Migration Analizer the System.Threading.dll that  
> I am using and it found some incompatibilities :
>
> System.Threading.dll
>
> P/Invokes into native code
>
> Calling Method	P/Invoke Method	External DLL
> Class System.Threading.Internal.Platform:
> void Yield()	int SwitchToThread()	kernel32.dll
>
>
> Methods called marked with [MonoTodo]
>
> Calling Method	Method with [MonoTodo]	Reason
> Class System.Threading.Tasks.Worker:
> void RunAsync(Task)	void CodeAccessPermission.Assert()	Imperative  
> mode isn't supported
> Class System.Threading.Tasks.Task:
> void Run(Int32&)	void ExecutionContext.Run(ExecutionContext,  
> ContextCallback, Object)	only the SecurityContext is considered
>

You should be fine, no need to worry about Mono's System.Threading.dll.


> Please let me know if you can what should I do in order to use your  
> patch

My patch was intended for the maintainers of Mono, so it was supposed  
to be applied to the SVN version of mcs ("svn co svn://anonsvn.mono- 
project.com/source/trunk/mcs"), via "patch -p0 < mypatch.diff". It  
might also be possible to apply the patch to the mcs subdirectory of  
e.g. the Mono 1.9.1 source tarball instead of SVN.

You could then cd to mcs/class/System.Threading.Parallel and run "make  
PROFILE=net_2_0 && make check PROFILE=net_2_0" and copy the generated  
System.Threading.Parallel.dll to your project's directory.

HTH,
Andreas


Btw a copy of this thread is also available here:
http://go-mono.com/forums/#nabble-to17461011

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20080527/430b0bf3/attachment-0001.html 


More information about the Mono-list mailing list