Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
Simple function to replace complicated Threads?
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Adam Turner
17y
2.2k
1
Reply
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();
}
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Can I make Horizontal Lines in my Windows Form?
Best way to capture windows logging off in application