Forum C# locking

locking

Postby Pawel Wozniak » January 22nd, 2013, 10:19 pm

I`m not fluent in C#.

I`m using lock() in GotMessage. What happend if message is received while thread is locked? i guess its not queued and can miss... ?
Pawel Wozniak
Paid Member
 
Posts: 96
Joined: October 14th, 2012, 10:47 pm

Re: locking

Postby Benjaminsen » January 23rd, 2013, 7:58 am

There is no misses, your message is queued.
Be ware that this can quickly make your game pass the 100ms execution threshold.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: locking

Postby Pawel Wozniak » January 27th, 2013, 12:40 pm

How can i check execution time for locked function ?
Pawel Wozniak
Paid Member
 
Posts: 96
Joined: October 14th, 2012, 10:47 pm

Re: locking

Postby afrokick » January 27th, 2013, 4:13 pm

http://msdn.microsoft.com/ru-ru/library ... watch.aspx

But I can not understand, why you use lock() for messages... lock should be used for objects, which may be changed in another place, and usually it's arrays..
User avatar
afrokick
 
Posts: 11
Joined: January 24th, 2013, 6:08 pm
Location: Belarus


Return to C#



cron