File: Change_Instance_Default.cpp

package info (click to toggle)
ace 6.2.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 49,348 kB
  • ctags: 42,082
  • sloc: cpp: 342,284; perl: 32,718; ansic: 20,838; sh: 3,759; python: 828; exp: 787; yacc: 511; xml: 330; lex: 158; lisp: 116; makefile: 82; csh: 20; tcl: 5
file content (37 lines) | stat: -rw-r--r-- 890 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
 * $Id: Change_Instance_Default.cpp 91813 2010-09-17 07:52:52Z johnnyw $
 *
 * Sample code from The ACE Programmer's Guide,
 * Copyright 2003 Addison-Wesley. All Rights Reserved.
 *
 * This code shows how to set the ACE_Log_Msg per-instance default
 * differently for groups of spawned threads.
 */

#include "ace/Log_Msg.h"
#include "ace/Thread_Manager.h"

ACE_THR_FUNC_RETURN worker (void *)
{
  // do some work
  return 0;
}

ACE_THR_FUNC_RETURN service (void *)
{
  // run the service
  return 0;
}

int ACE_TMAIN (int, ACE_TCHAR *[])
{
  // Listing 1 code/ch03
  ACE_LOG_MSG->priority_mask (0, ACE_Log_Msg::PROCESS);
  ACE_Log_Msg::enable_debug_messages ();
  ACE_Thread_Manager::instance ()->spawn (service);
  ACE_Log_Msg::disable_debug_messages ();
  ACE_Thread_Manager::instance ()->spawn_n (3, worker);
  // Listing 1
  ACE_Thread_Manager::instance ()->wait ();
  return 0;
}