Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Teets

Member Since 28 Jan 2012
Offline Last Active Aug 03 2016 03:06 PM
-----

Topics I've Started

No ParameterizedThreadStart

02 February 2012 - 04:21 AM

Just picked up a Netduino Plus last week! Already hooked on it...

Since the .NET Micro Framework only has ThreadStart and not ParameterizedThreadStart, how are you guys passing parameters to your threads? The idea is the Netduino acts as a server, flags a custom EventHandler when a request is received, and passes the request along to be processed on a separate thread.

I'm used to doing something like this:

public static void Main()
{
    ...

    // Watch for requests
    server.Request += new RequestEventHandler(server_Request);

    ...
}

static void server_Request(object sender, RequestEventArgs e)
{
    // Process the request on a new thread
    ParameterizedThreadStart threadStart = new ParameterizedThreadStart(ProcessRequest);
    Thread thread = new Thread(threadStart);

    thread.Start(e.Request);
}

static void ProcessRequest(object request)
{
    ...
}

Any ideas?

- NICK

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.