ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
[boost] Threads and mutexes : assign_to error
by Jacques Kerner other posts by this author
Apr 30 2003 12:44PM messages near this date
Re: [boost] ATTN: All Developers Interested in Boost.Preprocessor | Re: [boost] Threads and mutexes : assign_to error
Hi,

I get the following error :

error C2664: 'void boost::function0<R,Allocator> ::assign_to(Functor)' : 
unable to convert parameter 1 from 'const CTaskManager' to 'CTaskManager'

when doing this :

class CTaskManager
{
    public:
        CTaskManager();
        ~CTaskManager();
        void operator()() {}
   
    private:
        boost::mutex m_mutex;
}

and

CTaskManager taskManager;
boost::thread_group mainThreadGroup;
mainThreadGroup.create_thread(taskManager);
mainThreadGroup.join_all();

The error dissapears when I remove the mutex from the definition of  
CTaskManager ... (?!!)

So what is the right way to use mutex and threads together? Do I have to 
declare the mutex outside of the
functor? Why?




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Jacques Kerner
Douglas Gregor
Jacques Kerner
William E. Kempf

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved