|
-
Nov 2nd, 2005, 12:11 PM
#1
Thread Starter
Addicted Member
[RESOLVED] SyncLock
Hi,
in short: What's SyncLock?
thx
They shout: "Give us cheap oil!"
What will they shout when all the oil is gone? "Give us another planet full of oil!"
1 Cigarete takes away 15 minutes of life, 1 minute of laughter gives you 15 minutes of life. What should you do?
Smoke weed! 
-
Nov 2nd, 2005, 12:45 PM
#2
Hyperactive Member
Re: SyncLock
it is not easy to explain it in a short time, you had better check a book for details.
basically, if you are not using multi-thread, you do not need use it. synclock locks the variables, so multithreads can not share it at the same time.
-
Nov 2nd, 2005, 01:21 PM
#3
Thread Starter
Addicted Member
Re: SyncLock
 Originally Posted by temp_12000
it is not easy to explain it in a short time, you had better check a book for details.
basically, if you are not using multi-thread, you do not need use it. synclock locks the variables, so multithreads can not share it at the same time.
Dont think i need any more details, that very much clarifies it, but it's supposed to lock the variables for a specified thread from all the other threads, right?
They shout: "Give us cheap oil!"
What will they shout when all the oil is gone? "Give us another planet full of oil!"
1 Cigarete takes away 15 minutes of life, 1 minute of laughter gives you 15 minutes of life. What should you do?
Smoke weed! 
-
Nov 2nd, 2005, 07:23 PM
#4
Re: SyncLock
Only one thread can enter a SyncLock block at a time, so if one thread is currently executing code within the SyncLock block then any other threads will wait until that thread exits the block before ONE AND ONLY ONE of them enters. It is up to the system which is the lucky winner. I don't think that the order in which they arrive has any bearing on the order in which they enter. If several SyncLock blocks are passed the same object via their expressions then those SyncLock blocks are linked and no thread may enter any of them if another thread is currently executing any of them, whether it's the same block or not.
-
Nov 3rd, 2005, 03:00 AM
#5
Thread Starter
Addicted Member
Re: SyncLock
 Originally Posted by jmcilhinney
Only one thread can enter a SyncLock block at a time, so if one thread is currently executing code within the SyncLock block then any other threads will wait until that thread exits the block before ONE AND ONLY ONE of them enters. It is up to the system which is the lucky winner. I don't think that the order in which they arrive has any bearing on the order in which they enter. If several SyncLock blocks are passed the same object via their expressions then those SyncLock blocks are linked and no thread may enter any of them if another thread is currently executing any of them, whether it's the same block or not.
Thx, that covers it
They shout: "Give us cheap oil!"
What will they shout when all the oil is gone? "Give us another planet full of oil!"
1 Cigarete takes away 15 minutes of life, 1 minute of laughter gives you 15 minutes of life. What should you do?
Smoke weed! 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|