TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Adam Turner
NA
60
0
Simple function to replace complicated Threads?
Jul 12 2007 4:48 PM
Hello, I'm trying to figure out a nice way to create a simple spawn() function for a simple game engine I'm working on to make it easier to use Threads. I'm unfamiliar with events but I'm thinking that may be what I need to get rid of the while statement below. I'd like any help I can get as I'm fairly new to programming in anything other than BYOND.
My code:
public
delegate
void
function2call
();
public
void
spawn(
int
time2sleep,
function2call
_function,
ref
bool
isdone)
{
if
(_function ==
null
)
return
;
Thread
gamethread =
new
Thread
(
new
ThreadStart
(_function));
sleep(time2sleep);
gamethread.Start();
while
(!isdone) ;
gamethread.Join();
}
Reply
Answers (
2
)
Can I make Horizontal Lines in my Windows Form?
Best way to capture windows logging off in application