Click here to Skip to main content
15,888,008 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: When IS CFont create for the Bottomless CRichEdit ???? Pin
ForNow5-May-09 16:59
ForNow5-May-09 16:59 
GeneralRe: When IS CFont create for the Bottomless CRichEdit ???? Pin
ForNow6-May-09 4:42
ForNow6-May-09 4:42 
Questioncan VC++ 6.0 talk with SharePoint Server Pin
s33335-May-09 10:24
s33335-May-09 10:24 
AnswerRe: can VC++ 6.0 talk with SharePoint Server Pin
Stuart Dootson5-May-09 10:37
professionalStuart Dootson5-May-09 10:37 
QuestionSemaphore Max count. Pin
_80865-May-09 6:57
_80865-May-09 6:57 
AnswerRe: Semaphore Max count. Pin
Stuart Dootson5-May-09 7:26
professionalStuart Dootson5-May-09 7:26 
GeneralRe: Semaphore Max count. Pin
_80865-May-09 16:36
_80865-May-09 16:36 
GeneralRe: Semaphore Max count. Pin
Stuart Dootson5-May-09 17:00
professionalStuart Dootson5-May-09 17:00 
_8086 wrote:
Is it like at first the limit cap would be 3


The limit is always 5 - it's just that you start with lInitialCount slots available - the difference between the initial count and the maximum count is the number of used slots when the semaphore is created.

_8086 wrote:
S1 Released. SemVar++ = 1 (Now will it add 2 more counts here?)


No - the difference between the initial count and the maximum count is erased when you release the semaphore in threads that never acquired the semaphore. Let's say we have threads T0 and T1 and some worker threads Tw0-Tw5.

Let's say we want to create the semaphore with 5 slots, 2 of which are already reserved for T0 and T1. In that case, we use a maximum count of 5 and an initial count of 3 (5-3=2 slots, for T0 and T1).

Now, the effective count for threads Tw0-Tw5 to use is 3 until a thread that hasn't acquired the semaphore releases it.

So, if thread T0 calls ReleaseSemaphore (remember, it has never waited on the semaphore), the semaphore's effective count goes up to 4. If thread T1 then calls ReleaseSemaphore, its effective count goes up to 5.

Does that make sense?

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Semaphore Max count. Pin
_80865-May-09 17:20
_80865-May-09 17:20 
GeneralRe: Semaphore Max count. Pin
_80866-May-09 6:36
_80866-May-09 6:36 
GeneralRe: Semaphore Max count. Pin
Stuart Dootson6-May-09 7:24
professionalStuart Dootson6-May-09 7:24 
GeneralRe: Semaphore Max count. Pin
_80866-May-09 16:23
_80866-May-09 16:23 
GeneralRe: Semaphore Max count. Pin
Stuart Dootson6-May-09 19:32
professionalStuart Dootson6-May-09 19:32 
QuestionHelp about Win32 Message loop Pin
reply2am5-May-09 4:48
reply2am5-May-09 4:48 
QuestionAnimatedGif drawing with openGL Pin
Jufranz5-May-09 4:10
Jufranz5-May-09 4:10 
QuestionHow to Convert _asm to Interinsics Pin
AB_dev5-May-09 3:32
AB_dev5-May-09 3:32 
AnswerRe: How to Convert _asm to Interinsics Pin
Stuart Dootson5-May-09 3:42
professionalStuart Dootson5-May-09 3:42 
GeneralRe: How to Convert _asm to Interinsics Pin
AB_dev5-May-09 3:47
AB_dev5-May-09 3:47 
GeneralRe: How to Convert _asm to Interinsics Pin
harold aptroot5-May-09 4:02
harold aptroot5-May-09 4:02 
GeneralRe: How to Convert _asm to Interinsics Pin
Stuart Dootson5-May-09 4:03
professionalStuart Dootson5-May-09 4:03 
AnswerRe: How to Convert _asm to Interinsics Pin
Randor 5-May-09 7:45
professional Randor 5-May-09 7:45 
QuestionHow to add web reference in my C++ project? Pin
eight5-May-09 3:29
eight5-May-09 3:29 
AnswerRe: How to add web reference in my C++ project? Pin
Stuart Dootson5-May-09 3:35
professionalStuart Dootson5-May-09 3:35 
GeneralRe: How to add web reference in my C++ project? Pin
eight5-May-09 16:16
eight5-May-09 16:16 
GeneralRe: How to add web reference in my C++ project? Pin
Stuart Dootson5-May-09 16:51
professionalStuart Dootson5-May-09 16:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.