The changes are pretty simple.
The differences are basically that a windows thread function is
defined as DWORD WINAPI threadFunc( LPVOID argument ) - if you're
ignoring the return value, there's almost no difference.

The bigger difference is with mutexes - you create one with
CreateMutex, lock it with WaitForSingleObject, release it with
ReleaseMutex and destroy it with CloseHandle.

For more indepth information on mutexes, see
http://msdn.microsoft.com/library/en-us/dllproc/base/createmutex.asp?frame=true
For more indepth information on threads, see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/creating_threads.asp

Oh, and if you have any functions that are going to send messages
within the thread, make sure you use a mutex to lock the MessageBegin
and MessageEnd functions - I managed to mess some stuff up that way :)

On 8/5/05, Ben Davison <[EMAIL PROTECTED]> wrote:
> --
> [ Picked text/plain from multipart/alternative ]
> http://www.hl2coding.com/article.php?article=3
>
> On 8/5/05, Damien <[EMAIL PROTECTED]> wrote:
> >
> > Hi
> >
> > I've developped a mysql plugin tu use with srcds.
> > Due to performance issues, I'd like to make some operations go into
> > another
> > thread to avoid lag spikes... I've found a noob tutorial for posix threads
> > under linux, but how can I do same thing under windows ? Or do it with a
> > few
> > code changes ?
> > And is there a sample for the CUtlVector class ?
> >
> > Thanks
> >
> > Dede
> >
> >
> >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives,
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >
> >
>
>
> --
> - Ben Davison
> - http://www.shadow-phoenix.com
> --
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please 
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to