Thread.new Method

Initializes a new instance of the Thread class.

Syntax

public void new()

Run On

Called

Remarks

If an attacker can control input to the new method, a security risk exists. Therefore, this method runs under Code Access Security. Calls to this method on the server require permission from the ExecutePermission class. Make sure that the user has development permissions by setting the security key to SysDevelopment on the control that calls this method.

Examples

The following example creates a new thread and then executes a method from the SysCodeProfiler class.

void ThreadNewExample() 
{  
    Thread            t; 
    ExecutePermission perm; 
  
    perm = new ExecutePermission(); 
    if (!perm) 
    { 
        return; 
    } 
  
    perm.assert(); 
  
    t = new Thread(); 
    if (t) 
    { 
        t.removeOnComplete(true); 
        t.run(classnum(SysCodeProfiler), identifierstr(transferFile)); 
    } 
  
    CodeAccessPermission::revertAssert(); 
}

See Also

Thread Class

ExecutePermission Class

Code Access Security