Skip to content
Goliath1 edited this page Dec 22, 2014 · 12 revisions

CSharp

A library providing specific CSharp features.

Introduction

When necessary to use CSharp platform, one face the trouble when some specific CSharp keywords is lacking in Haxe. The library helps to use them. By now there is just one class Synchro providing thread synchronization.

Synchro

A static class providing synchronisation. It has two methods: lock and mutex.

Methods

Lock method implements a lock keyword. CSharp syntax is:

lock(LockedObject)
{
    /*Some code to synchronize.*/
}

The method needs two arguments: an object (Dynamic) and a callback (Void -> Void), so syntax looks like this:

lock(lockedObject, function() 
{
    /*Some code.*/
});

or

lock(lockedObject, someFunc);
...
function someFunc():Void
{
    /*Some code.*/
}

Note, that lockedOblect can be only of reference type. If it is not, SynchronizationLockException will be thrown.

Clone this wiki locally