[gameprogrammer] Re: Multi-Threading in C++
- From: "richard sabbarton" <richard.sabbarton@xxxxxxxxx>
- To: "Paulo Pinto" <pjmlp@xxxxxxxxxxxxx>
- Date: Thu, 3 May 2007 09:54:53 +0100
Hi Paulo,
Thank you very much for the heads up on that one. I have now looked into
this further and I have moved over to using _beginthread(). I had to change
my function definitions and ensure that they do not return any values and it
is now all working. I am glad I did this now at the beginning of my
project...
Thanks again.
Richard
On 03/05/07, Paulo Pinto <pjmlp@xxxxxxxxxxxxx> wrote:
Hi,
DO NOT use CreateThread() unless you are aware of its shortcomings.
http://msdn2.microsoft.com/en-us/library/ms682453.aspx
"A thread in an executable that calls the C run-time library (CRT) should
use
the _beginthreadex and _endthreadex functions for thread management rather
than
CreateThread and ExitThread; this requires the use of the multi-threaded
version
of the CRT. If a thread created using CreateThread calls the CRT, the CRT
may
terminate the process in low-memory conditions."
Cheers,
Paulo
Quoting richard sabbarton <richard.sabbarton@xxxxxxxxx>:
> Hi All,
>
> I am relatively new to the list and I am still learning. I am working
on a
> 3D game (personal learning project at the moment) and I am trying to
spawn a
> new thread at a certain point in my code. The purpose of this thread is
to
> pull objects, models and textures from files into memory (for OpenGL)
while
> I am continuing to render in the primary thread.
>
> So far I have created a thread and the thread spawns OK. It starts
running
> but during the loading process I am getting access violation errors when
> trying to access arrays of GLuint variables (for the textures). At this
> point the arrays are not in use by the primary thread so I thought I
would
> be able to avoid using any sort of mutex. I am still new to
> multi-threading and I am using the standard WINAPI CreateThread()
function.
>
> Can anyone offer any advice on how to do this or point me to any good
> tutorials online.
>
> Thanks
>
> Richard
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
- References:
- [gameprogrammer] Multi-Threading in C++
- From: richard sabbarton
- [gameprogrammer] Re: Multi-Threading in C++
- From: Paulo Pinto
Other related posts:
- » [gameprogrammer] Multi-Threading in C++
- » [gameprogrammer] Re: Multi-Threading in C++
- » [gameprogrammer] Re: Multi-Threading in C++
- » [gameprogrammer] Re: Multi-Threading in C++
- » [gameprogrammer] Re: Multi-Threading in C++
- » [gameprogrammer] Re: Multi-Threading in C++
Hi, DO NOT use CreateThread() unless you are aware of its shortcomings. http://msdn2.microsoft.com/en-us/library/ms682453.aspx "A thread in an executable that calls the C run-time library (CRT) should use the _beginthreadex and _endthreadex functions for thread management rather than CreateThread and ExitThread; this requires the use of the multi-threaded version of the CRT. If a thread created using CreateThread calls the CRT, the CRT may terminate the process in low-memory conditions." Cheers, Paulo Quoting richard sabbarton <richard.sabbarton@xxxxxxxxx>: > Hi All, > > I am relatively new to the list and I am still learning. I am working on a > 3D game (personal learning project at the moment) and I am trying to spawn a > new thread at a certain point in my code. The purpose of this thread is to > pull objects, models and textures from files into memory (for OpenGL) while > I am continuing to render in the primary thread. > > So far I have created a thread and the thread spawns OK. It starts running > but during the loading process I am getting access violation errors when > trying to access arrays of GLuint variables (for the textures). At this > point the arrays are not in use by the primary thread so I thought I would > be able to avoid using any sort of mutex. I am still new to > multi-threading and I am using the standard WINAPI CreateThread() function. > > Can anyone offer any advice on how to do this or point me to any good > tutorials online. > > Thanks > > Richard > ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
- [gameprogrammer] Multi-Threading in C++
- From: richard sabbarton
- [gameprogrammer] Re: Multi-Threading in C++
- From: Paulo Pinto