How to write plug for Thread Class

Topics: Other, Using Cosmos (Developing your own OS, projects, etc)
Dec 6, 2013 at 5:14 PM
Hello friends,
i am new to cosmos but not to dot net. i tried to use many class and dll files in my project but its all asking to write plugs. i tried to understand the use and the way to write plugs but i can't get any idea what it is an how to write it. Please some one help me the code i tired to use is:
"Thread.Sleep(100);"
and
"ThreadStart ts = new ThreadStart(LoadData);
Thread t = new Thread(ts);
t.Start();"

but both of asks me to write plugs. how to write it?
Dec 7, 2013 at 11:22 PM
I found this link at the Documentation section.
You might find some useful information.

http://www.codeproject.com/Articles/220076/Csharp-Open-Source-Managed-Operating-System-Intro
Dec 9, 2013 at 12:20 PM
Hello adriancs

thanks for your reply
i have seen that link but i can't understand any thing can you please give me a simple example
Dec 9, 2013 at 12:20 PM
Hello adriancs

thanks for your reply
i have seen that link but i can't understand any thing can you please give me a simple example
Dec 12, 2013 at 5:36 AM
Edited Dec 12, 2013 at 5:40 AM
i wrote a plug but it is not working. this is the plug i wrote:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cosmos.IL2CPU.Plugs;

namespace CosmosKernel3
{
    [Plug(Target = typeof(global::System.Threading.Thread))]
    [Plug(Target = typeof(global::System.Threading.ThreadStart))]
    class Thread1
    {
        public static int Sleep(int value)  
        {
                return value;  
        }
    }
}
i have also added the "System.Threading.Thread.dll" file to my project and this is my program code:
Console.ForegroundColor = ConsoleColor.Green;
            while (true)
            {
                Console.WriteLine("0  0     0  1           0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1  1     1  1  0        0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1        1  1  1  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0        1  0  1  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1  0     0  0  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("   1     1  0  1  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("   1     0  1  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("   1     1  0  1  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("   0  0  0  1  0  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("   0  1     0  1  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("   0  1        0  1  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("      1           0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("      1  0           1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0     0  0           0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0     0  1           1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1     0  0  0        1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0     0  0  1  0     1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1     0  1  0  1  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0     0  1  1  0  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1     0  0  0  1  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0     0  1  1  0  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0     0     1  1  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1     0        0  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1     0           0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Thread.Sleep(60000);     //this is were i am getting the error if no native is written
            }
if the plug is not written its giving me the error to write plug, but when i written the above given plug its not showing any error and it is running well. but it doesn't seems to be running the "Thread.Sleep(60000);" code.
some one give me a solution
Coordinator
Dec 12, 2013 at 6:12 AM
In what project did you define the plug?
Also, make the class public.



2013/12/12 roitheninja <[email removed]>

From: roitheninja

i wrote a plug but it is not working. this is the plug i wrote:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cosmos.IL2CPU.Plugs;

namespace CosmosKernel3
{
    [Plug(Target = typeof(global::System.Threading.Thread))]
    [Plug(Target = typeof(global::System.Threading.ThreadStart))]
    class Thread1
    {
        public static int Sleep(int value)  
        {
                return value;  
        }
    }
}
i have also added the "System.Threading.Thread.dll" file to my project and this is my program code:
Console.ForegroundColor = ConsoleColor.Green;
            while (true)
            {
                Console.WriteLine("0  0     0  1           0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1  1     1  1  0        0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1        1  1  1  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0        1  0  1  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1  0     0  0  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("   1     1  0  1  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("   1     0  1  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("   1     1  0  1  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("   0  0  0  1  0  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("   0  1     0  1  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("   0  1        0  1  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("      1           0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("      1  0           1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0     0  0           0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0     0  1           1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1     0  0  0        1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0     0  0  1  0     1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1     0  1  0  1  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0     0  1  1  0  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1     0  0  0  1  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0     0  1  1  0  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("0     0     1  1  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1     0        0  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Console.WriteLine("1     0           0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ");
                Thread.Sleep(60000);
            }
some one give me a solution

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 12, 2013 at 3:06 PM
the project i used "C# Operating System".
i have changed the class to public, now its touching the code but an error is showing "CPU error x86" and the vmware is staying still.
here is a link to my project file:
http://theblackkingdom.webs.com/CosmosKernel3.rar

you can download it from here my project and examin it
Coordinator
Dec 12, 2013 at 3:29 PM
Can you post a screenshot?



2013/12/12 roitheninja <[email removed]>

From: roitheninja

the project i used "C# Operating System".
i have changed the class to public, now its touching the code but an error is showing "CPU error x86" and the vmware is staying still.
here is a link to my project file:
http://theblackkingdom.webs.com/CosmosKernel3.rar

you can download it from here my project and examin it

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 12, 2013 at 5:06 PM
the font in the green color were made by me and the font in red is the error
Image
Coordinator
Dec 12, 2013 at 6:08 PM

That's CPU exception 6. Invalid opcode.

Probably means there's a compiler bug you're hitting....

Op 12 dec. 2013 19:06 schreef "roitheninja" <[email removed]>:

From: roitheninja

the font in the green color were made by me and the font in red is the error
Image

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Dec 13, 2013 at 2:03 AM
what is opcode? I there any solution for this
Coordinator
Dec 13, 2013 at 7:20 AM
The error means the cpu came across data it couldn't recognize as instructions. In our case, that usually means there's some stack corruption somewhere due to a bug in the compiler..
It might be due to your use of the Thread class, which is not supported...



2013/12/13 roitheninja <[email removed]>

From: roitheninja

what is opcode? I there any solution for this

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 13, 2013 at 6:01 PM
hmm... sad. thanks for your response...