run a piece of code without context switching

caligul

run a piece of code without context switching

by caligul » Wed, 13 Feb 2008 00:44:56

Hi,
i want two lines of my code to be executed uninteruptedly by other threads so that before accomplishing execution of them no other instructions in my process will be executed.
It means that until the end of execution of them no other thread will gain processor.
Is there any way to handle this problem
regards
ma lobatakanim o falak lobat baz



Sven

run a piece of code without context switching

by Sven » Fri, 15 Feb 2008 01:45:57

Can you design your app so that you start the other threads not before those special lines have been executed

What makes them special Do they modify some shared object If so you can lock that object on all threads that access it, so only one has access at a time.

--
SvenC


caligul

run a piece of code without context switching

by caligul » Sat, 16 Feb 2008 03:47:59

you can do this by lock keyword.



caligul

run a piece of code without context switching

by caligul » Sun, 17 Feb 2008 02:46:58

nope there is no way to run other threads after that.
actually an event is fired and handled in some other thread that cause side effect on object which i work with in those two lines.