[ace-users] [quesion] on ACE_Thread_Manager

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Wed Jul 11 03:39:05 CDT 2007


Hi Jeong,

Thanks for using the PRF.

>     ACE VERSION: 5.5.4

Please upgrade to ACE+TAO+CIAO x.5.9 (i.e., ACE 5.5.9, TAO 1.5.9, and
CIAO 0.5.9), which you can download from

http://download.dre.vanderbilt.edu

under the heading: "Latest Beta Kit".

The DOC groups at Washington University, UC Irvine, and Vanderbilt
University only provide "best effort" support for non-sponsors for the
latest release, as described in

http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/docs/ACE-bug-process.html

Thus, if you need more "predictable" help for earlier versions of
ACE+TAO, I recommend that you check out

http://www.dre.vanderbilt.edu/support.html

for a list of companies that will provide you with ACE+TAO commercial
support.

>     HOST MACHINE and OPERATING SYSTEM:
>         Host Machine: Intel Centrio Duo 2GHz meory 1.5GB
>         OS: Windows Professional SP2
> 
>     TARGET MACHINE and OPERATING SYSTEM: Same with Host Machine and OS
> 
>     THE $ACE_ROOT/ace/config.h FILE
> 
>          #define ACE_HAS_STANDARD_CPP_LIBRARY 1
>          #define ACE_HAS_MFC 1
>          #define ACE_NO_INLINE
>          #include "ace/config-win32.h"
> 
>     AREA/CLASS/EXAMPLE AFFECTED:
>         ACE_Thread_Manager
> 
>     DOES THE PROBLEM AFFECT:
>         EXECUTION
> 
>     SYNOPSIS:
>        occurrance of excpetion on the function callled
> "thread_mutex_lock" in the file
>        of os_ns_thread.inl
> 
>     DESCRIPTION:
>       When executing my simple program based on ACE_Thread_Manager,
>       an exception occures at the marked point:
> 
>       ACE_INLINE int
>       ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m)
>       {
>         // ACE_OS_TRACE ("ACE_OS::thread_mutex_lock");
>       #if defined (ACE_HAS_THREADS)
>       # if defined (ACE_HAS_WTHREADS)

Have you made sure to initialize ACE by calling ACE::init() at the start
of your main() function?

Thanks,

        Doug

> ->   ::EnterCriticalSection (m);
>         return 0;
>       # elif defined (ACE_HAS_STHREADS) || defined (ACE_HAS_PTHREADS)
> || defined                  (ACE_VXWORKS)
>         return ACE_OS::mutex_lock (m);
> 
>        my simple program as followed
>        testthread.cpp
>        #include "stdafx.h"
>        #include "Thread.h"
> 
>        int main(int argc, char* argv[])
>        {
>        	       CThread thread;
> 	       thread.start(10);
> 	       return 0;
>        }
> 
>       thread.h
>       #pragma once
> 
>       class CThread
>       {
>       public:
> 	      CThread(void);
>       public:
> 	      ~CThread(void);
> 
>       private:
> 	      struct Thread_Args
> 	      {
> 	      public:
> 		      Thread_Args(/*unsigned short id,*/ CThread* lsp) :
> /*id_(id),*/ this_(lsp) {}
> 		      CThread* this_;
> //		      unsigned short id_;
> 	      };
> 
> 	      static void* run_svc (void* arg);
> 
>       public:
> 	      void start(unsigned short);
>       };
> 
>      thread.cpp
>      #include "StdAfx.h"
>      #include "Thread.h"
>      #include <iostream>
> 
>      #include "ace/Basic_Types.h"
>      #include "ace/Thread_Manager.h"
>      #include "ace/Log_Msg.h"
> 
>      using namespace std;
> 
>      CThread::CThread(void)
>      {
>      }
> 
>      CThread::~CThread(void)
>      {
>      }
> 
>      void* CThread::run_svc(void* arg)
>      {
> 	     while(1)
>      	     {
> 	     	     cout << "1" << endl;
> 	     }
>      /*
> 	     //	Thread_Args *thread_args = ACE_static_cast(Thread_Args*, arg);
> 
> 
> 
>      //	for(int i = 0; i < thread_args->id_; i++)
>      //		cout << thread_args->id_ << " is running" << endl;
> 
>      //	delete thread_args;
>      */
> 	     return 0;
>      }
> 
>      void CThread::start(unsigned short id)
>      {
> 	     Thread_Args *thread_args = new Thread_Args(/*id,*/ this);
>      	     if(ACE_Thread_Manager::instance()->spawn((ACE_THR_FUNC)CThread::run_svc,
>      ACE_static_cast(void*, thread_args), THR_DETACHED |
> THR_SCOPE_PROCESS) == -1)
> 		     return;
>      }
> 
> _______________________________________________
> ace-users mailing list
> ace-users at mail.cse.wustl.edu
> http://mail.cse.wustl.edu/mailman/listinfo/ace-users



More information about the Ace-users mailing list