Re: [hlcoders] Multithreaded Plugin CRT

2007-09-05 Thread Gren Meera
--
[ Picked text/plain from multipart/alternative ]
There doesn't appear to be any main engine API function calls from anywhere
but the main thread.  The additional threads are worker threads that only
create connections and poll the IO.

To create a new connection, there's a pending list that is dumped to the
other thread behind a critical section, and all finalization is dumped to a
pending finalize list to also be cleared out (deleted) from the main thread
behind a critical section.  I'm trying to find ANY possible "new" and
"delete" calls that might take place across the threads that shouldn't.

Should I be including the standard:
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

and is there an incompatible CRT for code generation?

On 9/5/07, Jeffrey botman Broome <[EMAIL PROTECTED]> wrote:
>
> Gren Meera wrote:
> > --
> > [ Picked text/plain from multipart/alternative ]
> > Hey everybody, I could REALLY use a hand with this!
> >
> > I needed to make a multi-threaded plugin to handle Port IO for external
> > hardware.  The problem is, the MOD always crashes when unloading DLLs
> when
> > my plugin is loaded.
> >
> > It dies in random destructors from many different DLLs, but usually it's
> the
> > destructor of some global CUtlVector, such as the destructor of
> > CCollisionEvent g_Collisions.
>
> Is your plugin only doing game engine API access through the main
> thread? (i.e. you shouldn't be calling any engine functions from
> anything except for your main plugin DLL thread since the engine isn't
> thread safe).
>
> Changing your DLL to be thread safe (i.e. setting "Multi-threaded Debug
> DLL") won't make the engine be thread safe.
>
> You will probably need so mechanism of signaling between your Port IO
> threads and your main thread and funnel all engine API access through
> your main thread (i.e. the only thing the threads should do it I/O and
> then send that stuff to your main thread who would in turn call engine
> functions).
>
> --
> Jeffrey "botman" Broome
>
> ___
> 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



Re: [hlcoders] Multithreaded Plugin CRT

2007-09-05 Thread Jeffrey \"botman\" Broome

Gren Meera wrote:

--
[ Picked text/plain from multipart/alternative ]
Hey everybody, I could REALLY use a hand with this!

I needed to make a multi-threaded plugin to handle Port IO for external
hardware.  The problem is, the MOD always crashes when unloading DLLs when
my plugin is loaded.

It dies in random destructors from many different DLLs, but usually it's the
destructor of some global CUtlVector, such as the destructor of
CCollisionEvent g_Collisions.


Is your plugin only doing game engine API access through the main
thread? (i.e. you shouldn't be calling any engine functions from
anything except for your main plugin DLL thread since the engine isn't
thread safe).

Changing your DLL to be thread safe (i.e. setting "Multi-threaded Debug
DLL") won't make the engine be thread safe.

You will probably need so mechanism of signaling between your Port IO
threads and your main thread and funnel all engine API access through
your main thread (i.e. the only thing the threads should do it I/O and
then send that stuff to your main thread who would in turn call engine
functions).

--
Jeffrey "botman" Broome

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



[hlcoders] Multithreaded Plugin CRT

2007-09-05 Thread Gren Meera
--
[ Picked text/plain from multipart/alternative ]
Hey everybody, I could REALLY use a hand with this!

I needed to make a multi-threaded plugin to handle Port IO for external
hardware.  The problem is, the MOD always crashes when unloading DLLs when
my plugin is loaded.

It dies in random destructors from many different DLLs, but usually it's the
destructor of some global CUtlVector, such as the destructor of
CCollisionEvent g_Collisions.

I've tried adding memoverride.cpp to the project, and I've tried changing
the project runtime library from "Multi-threaded Debug" to "Multi-threaded
Debug DLL" to "Single threaded Debug", and every combination thereof.

I think it has something to do with the tier0 memory management and
overloading the CRT, but I have no idea how to fix this.  All help is
greatly appreciated.
--

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