File: io_service.html

package info (click to toggle)
boost1.42 1.42.0-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 277,864 kB
  • ctags: 401,076
  • sloc: cpp: 1,235,659; xml: 74,142; ansic: 41,313; python: 26,756; sh: 11,840; cs: 2,118; makefile: 655; perl: 494; yacc: 456; asm: 353; csh: 6
file content (529 lines) | stat: -rwxr-xr-x 29,092 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>io_service</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../boost_asio.html" title="Boost.Asio">
<link rel="up" href="../reference.html" title="Reference">
<link rel="prev" href="invalid_service_owner/invalid_service_owner.html" title="invalid_service_owner::invalid_service_owner">
<link rel="next" href="io_service/add_service.html" title="io_service::add_service">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="invalid_service_owner/invalid_service_owner.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="io_service/add_service.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a>
</div>
<div class="section" title="io_service">
<div class="titlepage"><div><div><h3 class="title">
<a name="boost_asio.reference.io_service"></a><a class="link" href="io_service.html" title="io_service"> io_service</a>
</h3></div></div></div>
<p>
        Provides core I/O functionality.
      </p>
<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">io_service</span> <span class="special">:</span>
  <span class="identifier">noncopyable</span>
</pre>
<a name="boost_asio.reference.io_service.types"></a><h5>
<a name="id940620"></a>
        <a class="link" href="io_service.html#boost_asio.reference.io_service.types">Types</a>
      </h5>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
              <p>
                Name
              </p>
              </th>
<th>
              <p>
                Description
              </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
              <p>
                <a class="link" href="io_service__id.html" title="io_service::id"><span class="bold"><strong>id</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Class used to uniquely identify a service.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service__service.html" title="io_service::service"><span class="bold"><strong>service</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Base class for all io_service services.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service__strand.html" title="io_service::strand"><span class="bold"><strong>strand</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Provides serialised handler execution.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service__work.html" title="io_service::work"><span class="bold"><strong>work</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Class to inform the io_service when it has work to do.
              </p>
              </td>
</tr>
</tbody>
</table></div>
<a name="boost_asio.reference.io_service.member_functions"></a><h5>
<a name="id940783"></a>
        <a class="link" href="io_service.html#boost_asio.reference.io_service.member_functions">Member Functions</a>
      </h5>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
              <p>
                Name
              </p>
              </th>
<th>
              <p>
                Description
              </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
              <p>
                <a class="link" href="io_service/dispatch.html" title="io_service::dispatch"><span class="bold"><strong>dispatch</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Request the io_service to invoke the given handler.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service/io_service.html" title="io_service::io_service"><span class="bold"><strong>io_service</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Constructor.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service/poll.html" title="io_service::poll"><span class="bold"><strong>poll</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Run the io_service object's event processing loop to execute ready
                handlers.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service/poll_one.html" title="io_service::poll_one"><span class="bold"><strong>poll_one</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Run the io_service object's event processing loop to execute one
                ready handler.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service/post.html" title="io_service::post"><span class="bold"><strong>post</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Request the io_service to invoke the given handler and return immediately.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service/reset.html" title="io_service::reset"><span class="bold"><strong>reset</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Reset the io_service in preparation for a subsequent run() invocation.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service/run.html" title="io_service::run"><span class="bold"><strong>run</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Run the io_service object's event processing loop.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service/run_one.html" title="io_service::run_one"><span class="bold"><strong>run_one</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Run the io_service object's event processing loop to execute at most
                one handler.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service/stop.html" title="io_service::stop"><span class="bold"><strong>stop</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Stop the io_service object's event processing loop.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service/wrap.html" title="io_service::wrap"><span class="bold"><strong>wrap</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Create a new handler that automatically dispatches the wrapped handler
                on the io_service.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service/_io_service.html" title="io_service::~io_service"><span class="bold"><strong>~io_service</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Destructor.
              </p>
              </td>
</tr>
</tbody>
</table></div>
<a name="boost_asio.reference.io_service.friends"></a><h5>
<a name="id941152"></a>
        <a class="link" href="io_service.html#boost_asio.reference.io_service.friends">Friends</a>
      </h5>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
              <p>
                Name
              </p>
              </th>
<th>
              <p>
                Description
              </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
              <p>
                <a class="link" href="io_service/add_service.html" title="io_service::add_service"><span class="bold"><strong>add_service</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Add a service object to the io_service.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service/has_service.html" title="io_service::has_service"><span class="bold"><strong>has_service</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Determine if an io_service contains a specified service type.
              </p>
              </td>
</tr>
<tr>
<td>
              <p>
                <a class="link" href="io_service/use_service.html" title="io_service::use_service"><span class="bold"><strong>use_service</strong></span></a>
              </p>
              </td>
<td>
              <p>
                Obtain the service object corresponding to the given type.
              </p>
              </td>
</tr>
</tbody>
</table></div>
<p>
        The <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a>
        class provides the core I/O functionality for users of the asynchronous I/O
        objects, including:
      </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
          boost::asio::ip::tcp::socket
        </li>
<li class="listitem">
          boost::asio::ip::tcp::acceptor
        </li>
<li class="listitem">
          boost::asio::ip::udp::socket
        </li>
<li class="listitem">
          boost::asio::deadline_timer.
        </li>
</ul></div>
<p>
        The <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a>
        class also includes facilities intended for developers of custom asynchronous
        services.
      </p>
<a name="boost_asio.reference.io_service.thread_safety"></a><h5>
<a name="id941353"></a>
        <a class="link" href="io_service.html#boost_asio.reference.io_service.thread_safety">Thread Safety</a>
      </h5>
<p>
        <span class="bold"><strong>Distinct</strong></span> <span class="bold"><strong>objects:</strong></span>
        Safe.
      </p>
<p>
        <span class="bold"><strong>Shared</strong></span> <span class="bold"><strong>objects:</strong></span>
        Safe, with the exception that calling <code class="computeroutput"><span class="identifier">reset</span><span class="special">()</span></code> while there are unfinished <code class="computeroutput"><span class="identifier">run</span><span class="special">()</span></code>,
        <code class="computeroutput"><span class="identifier">run_one</span><span class="special">()</span></code>,
        <code class="computeroutput"><span class="identifier">poll</span><span class="special">()</span></code>
        or <code class="computeroutput"><span class="identifier">poll_one</span><span class="special">()</span></code>
        calls results in undefined behaviour.
      </p>
<a name="boost_asio.reference.io_service.synchronous_and_asynchronous_operations"></a><h5>
<a name="id941480"></a>
        <a class="link" href="io_service.html#boost_asio.reference.io_service.synchronous_and_asynchronous_operations">Synchronous
        and asynchronous operations</a>
      </h5>
<p>
        Synchronous operations on I/O objects implicitly run the <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> object for an individual
        operation. The <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> functions <code class="computeroutput"><span class="identifier">run</span><span class="special">()</span></code>,
        <code class="computeroutput"><span class="identifier">run_one</span><span class="special">()</span></code>,
        <code class="computeroutput"><span class="identifier">poll</span><span class="special">()</span></code>
        or <code class="computeroutput"><span class="identifier">poll_one</span><span class="special">()</span></code>
        must be called for the <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> to perform asynchronous
        operations on behalf of a C++ program. Notification that an asynchronous
        operation has completed is delivered by invocation of the associated handler.
        Handlers are invoked only by a thread that is currently calling any overload
        of <code class="computeroutput"><span class="identifier">run</span><span class="special">()</span></code>,
        <code class="computeroutput"><span class="identifier">run_one</span><span class="special">()</span></code>,
        <code class="computeroutput"><span class="identifier">poll</span><span class="special">()</span></code>
        or <code class="computeroutput"><span class="identifier">poll_one</span><span class="special">()</span></code>
        for the <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a>.
      </p>
<a name="boost_asio.reference.io_service.effect_of_exceptions_thrown_from_handlers"></a><h5>
<a name="id941687"></a>
        <a class="link" href="io_service.html#boost_asio.reference.io_service.effect_of_exceptions_thrown_from_handlers">Effect
        of exceptions thrown from handlers</a>
      </h5>
<p>
        If an exception is thrown from a handler, the exception is allowed to propagate
        through the throwing thread's invocation of <code class="computeroutput"><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">poll_one</span><span class="special">()</span></code>. No other threads that are calling any
        of these functions are affected. It is then the responsibility of the application
        to catch the exception.
      </p>
<p>
        After the exception has been caught, the <code class="computeroutput"><span class="identifier">run</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">run_one</span><span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">poll</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">poll_one</span><span class="special">()</span></code> call may be restarted <span class="bold"><strong>without</strong></span>
        the need for an intervening call to <code class="computeroutput"><span class="identifier">reset</span><span class="special">()</span></code>. This allows the thread to rejoin the
        <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a>
        object's thread pool without impacting any other threads in the pool.
      </p>
<p>
        For example:
      </p>
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span> <span class="identifier">io_service</span><span class="special">;</span>
<span class="special">...</span>
<span class="keyword">for</span> <span class="special">(;;)</span>
<span class="special">{</span>
  <span class="keyword">try</span>
  <span class="special">{</span>
    <span class="identifier">io_service</span><span class="special">.</span><span class="identifier">run</span><span class="special">();</span>
    <span class="keyword">break</span><span class="special">;</span> <span class="comment">// run() exited normally
</span>  <span class="special">}</span>
  <span class="keyword">catch</span> <span class="special">(</span><span class="identifier">my_exception</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">)</span>
  <span class="special">{</span>
    <span class="comment">// Deal with exception as appropriate.
</span>  <span class="special">}</span>
<span class="special">}</span>
</pre>
<a name="boost_asio.reference.io_service.stopping_the_io_service_from_running_out_of_work"></a><h5>
<a name="id942045"></a>
        <a class="link" href="io_service.html#boost_asio.reference.io_service.stopping_the_io_service_from_running_out_of_work">Stopping
        the io_service from running out of work</a>
      </h5>
<p>
        Some applications may need to prevent an <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> object's <code class="computeroutput"><span class="identifier">run</span><span class="special">()</span></code> call
        from returning when there is no more work to do. For example, the <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> may be being run in a
        background thread that is launched prior to the application's asynchronous
        operations. The <code class="computeroutput"><span class="identifier">run</span><span class="special">()</span></code>
        call may be kept running by creating an object of type <a class="link" href="io_service__work.html" title="io_service::work"><code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">work</span></code></a>:
      </p>
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span> <span class="identifier">io_service</span><span class="special">;</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">work</span> <span class="identifier">work</span><span class="special">(</span><span class="identifier">io_service</span><span class="special">);</span>
<span class="special">...</span> 
</pre>
<p>
        To effect a shutdown, the application will then need to call the <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> object's <code class="computeroutput"><span class="identifier">stop</span><span class="special">()</span></code>
        member function. This will cause the <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> <code class="computeroutput"><span class="identifier">run</span><span class="special">()</span></code> call to return as soon as possible, abandoning
        unfinished operations and without permitting ready handlers to be dispatched.
      </p>
<p>
        Alternatively, if the application requires that all operations and handlers
        be allowed to finish normally, the work object may be explicitly destroyed.
      </p>
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span> <span class="identifier">io_service</span><span class="special">;</span>
<span class="identifier">auto_ptr</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">work</span><span class="special">&gt;</span> <span class="identifier">work</span><span class="special">(</span>
    <span class="keyword">new</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">work</span><span class="special">(</span><span class="identifier">io_service</span><span class="special">));</span>
<span class="special">...</span>
<span class="identifier">work</span><span class="special">.</span><span class="identifier">reset</span><span class="special">();</span> <span class="comment">// Allow run() to exit. 
</span></pre>
<a name="boost_asio.reference.io_service.the_io_service_class_and_i_o_services"></a><h5>
<a name="id942502"></a>
        <a class="link" href="io_service.html#boost_asio.reference.io_service.the_io_service_class_and_i_o_services">The
        io_service class and I/O services</a>
      </h5>
<p>
        Class <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a>
        implements an extensible, type-safe, polymorphic set of I/O services, indexed
        by service type. An object of class <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> must be initialised before
        I/O objects such as sockets, resolvers and timers can be used. These I/O
        objects are distinguished by having constructors that accept an <code class="computeroutput"><span class="identifier">io_service</span><span class="special">&amp;</span></code>
        parameter.
      </p>
<p>
        I/O services exist to manage the logical interface to the operating system
        on behalf of the I/O objects. In particular, there are resources that are
        shared across a class of I/O objects. For example, timers may be implemented
        in terms of a single timer queue. The I/O services manage these shared resources.
      </p>
<p>
        Access to the services of an <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> is via three function
        templates, <code class="computeroutput"><span class="identifier">use_service</span><span class="special">()</span></code>,
        <code class="computeroutput"><span class="identifier">add_service</span><span class="special">()</span></code>
        and <code class="computeroutput"><span class="identifier">has_service</span><span class="special">()</span></code>.
      </p>
<p>
        In a call to <code class="computeroutput"><span class="identifier">use_service</span><span class="special">&lt;</span><span class="identifier">Service</span><span class="special">&gt;()</span></code>, the type argument chooses a service,
        making available all members of the named type. If <code class="computeroutput"><span class="identifier">Service</span></code>
        is not present in an <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a>, an object of type <code class="computeroutput"><span class="identifier">Service</span></code> is created and added to the <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a>.
        A C++ program can check if an <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> implements a particular
        service with the function template <code class="computeroutput"><span class="identifier">has_service</span><span class="special">&lt;</span><span class="identifier">Service</span><span class="special">&gt;()</span></code>.
      </p>
<p>
        Service objects may be explicitly added to an <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> using the function template
        <code class="computeroutput"><span class="identifier">add_service</span><span class="special">&lt;</span><span class="identifier">Service</span><span class="special">&gt;()</span></code>.
        If the <code class="computeroutput"><span class="identifier">Service</span></code> is already
        present, the <a class="link" href="service_already_exists.html" title="service_already_exists"><code class="computeroutput"><span class="identifier">service_already_exists</span></code></a> exception
        is thrown. If the owner of the service is not the same object as the <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a>
        parameter, the <a class="link" href="invalid_service_owner.html" title="invalid_service_owner"><code class="computeroutput"><span class="identifier">invalid_service_owner</span></code></a> exception
        is thrown.
      </p>
<p>
        Once a service reference is obtained from an <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> object by calling <code class="computeroutput"><span class="identifier">use_service</span><span class="special">()</span></code>,
        that reference remains usable as long as the owning <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> object exists.
      </p>
<p>
        All I/O service implementations have <a class="link" href="io_service__service.html" title="io_service::service"><code class="computeroutput"><span class="identifier">io_service</span><span class="special">::</span><span class="identifier">service</span></code></a> as a public base class.
        Custom I/O services may be implemented by deriving from this class and then
        added to an <a class="link" href="io_service.html" title="io_service"><code class="computeroutput"><span class="identifier">io_service</span></code></a> using the facilities
        described above.
      </p>
<a name="boost_asio.reference.io_service.requirements"></a><h5>
<a name="id942975"></a>
        <a class="link" href="io_service.html#boost_asio.reference.io_service.requirements">Requirements</a>
      </h5>
<p>
        <span class="bold"><strong>Header: </strong></span><code class="literal">boost/asio/io_service.hpp</code>
      </p>
<p>
        <span class="bold"><strong>Convenience header: </strong></span><code class="literal">boost/asio.hpp</code>
      </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2003 - 2010 Christopher M. Kohlhoff<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="invalid_service_owner/invalid_service_owner.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="io_service/add_service.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>