Wrox Programmer Forums
|
Visual C++ 2005 For discussion of Visual C++ 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 22nd, 2008, 06:14 AM
Registered User
 
Join Date: Feb 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with _beginthread

 Hello all,
 is somebody could help me solve
 problem with start of new thread?
 I am trying to use
    // Start new thread
        ThreadHandle = _beginthread(TestThread, 4096, NULL);

    from method of class Server. Proc function "TestThread"also is member of this class
    where
     void Server::TestThread(void *) {
      logger.log2ScreenAndFile("Thread started");
}
1) I have error: 1>.\Server.cpp(183) : error C3867: 'Server::TestThread': function call missing argument list; use '&Server::TestThread' to create a pointer to member

 Why I have to use &Server::TestThread?? not TestThread?

2) but ater _beginthread(&Server::TestThread, 4096, NULL);
  I have next error C2664: '_beginthread' : cannot convert parameter 1 from 'void (__thiscall Server::* )(void *)' to 'void (__cdecl *)(void *)'

  What is correct way to start thread??
 Thanks a lot












Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.