This project is read-only.
Multithreading is vital in modern computer systems (laptops, desktops, servers, mainframes, etc).
As the technology advance, we have an increasing number of processors and cores per machine, while the maximum clock remains the same (about 3.0GHz).
This increasing number of cores cannot work on the same thread at the same time, thus making a single threaded application effectiveness very low.
But what does it means to the programmers? It means they have to separate the tasks the app will do in different threads, so they can be executed
simultaneously, taking maximum advantage of the CPU(s).

And what feature does Reflective# have in order to simplify the thread creation process?
The answer is quite simple: the threaded keyword.

The threaded keyword:

The threaded keyword offers a simple, comfortable and effective solution for easy-to-do thread creation.
Just apply threaded to your dream, and the calls to it will be converted in the creation of a new thread,
with the method as the entry point.
Note: Reflective# doesn't have methods, it have dreams instead. See Dreaming for more information.
For example:

If you wish to create a new thread in C# with some method as the entry point you would do:

public void SomeMethod()
      //do stuff
public static void Main(string[] args)
      Thread t = new Thread(new ThreadStart(this.SomeMethod));
      //Do stuff...
      if(shouldAbort) { t.Abort(); }
In Reflective# the above simplifies to:
public threaded void SomeDream()
public static void Main(string[] args)
    SomeDream(); //as the dream was declared as _threaded_ it will automatically start up in a new thread.
    //do stuff....
    if(shouldAbort) { SomeDream.Abort(); } //Dreams are also objects, which have properties and methods

Last edited Feb 18, 2012 at 6:35 PM by matheus2740, version 5


No comments yet.