Ideally you'd want to use a cancellation token or static variable to cancel the thread safely.
If you decide to use the cancellationToken/tokenSource:
var tokenSource = new CancellationTokenSource();
var token = tokenSource.Token;
...
static void DoSomething1or2(CancellationToken token, CancellationTokenSource tokenSource)
{
//Do other work here
//Since you said neither of your tasks were looping, just put this where
//you'd want to cancel the thread
if(token.IsCancellationRequested)
return; // or token.ThrowIfCancellationRequested();
//do some more stuff here
tokenSource.IsCancellationRequested = true;
}
If your doSomething method is looping then you could check a boolean at the beginning or end of each loop to see whether the other thread is completed. This technique is fairly similar to the cancellationToken.
if(otherThreadIsActive && originalCondition)
{
//do stuff here
}
If you can't wait for that iteration to finish, or can't use cancellation token, then I'd suggest reading this thread on aborting. Best not to use it unless it's absolutely necessary.
Best way: use a cancellation token/tokenSource
Next best way: use some sort of boolean to dictate when to terminate