I want to create a thread from XPCOM Component ... Here is a code for that
nsresult rv = NS_OK;
nsCOMPtr<Callback> obj = do_CreateInstance("@jscallback.p2psearch.com/f2f;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
char* str="Hello from C++";
obj->Status(str);
_beginthread( (void(*)(void* ))&(P2P::test), 0,obj);
return NS_OK;//obj->Status(str);
And here is a thread function
When I call function before calling thread It works But As soon as I write something like obj->Status(temp);
Firefox crashes on function this call
class P2P{
static char RecvBuf[1024];
public:
static void test(Callback* obj){
// char* temp="Hellllllooo";
// obj->Status(temp);
return;
}
};