btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / cortex / support / observe.cpp
blobf55ad9c419b7e02c3dda6013a1dafec0f726a7b9
1 /*
2 * Copyright (c) 1999-2000, Eric Moon.
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions, and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 // observe.cpp
34 #include "observe.h"
36 #include <Debug.h>
37 #include <Message.h>
39 //__USE_CORTEX_NAMESPACE
41 // -------------------------------------------------------- //
42 // *** HELPERS ***
43 // -------------------------------------------------------- //
45 // * Asynchronous
47 status_t __CORTEX_NAMESPACE__ add_observer(
48 const BMessenger& observer,
49 const BMessenger& target) {
50 // ASSERT(observer.IsValid());
51 // ASSERT(target.IsValid());
53 BMessage m(M_ADD_OBSERVER);
54 m.AddMessenger("observer", observer);
55 return target.SendMessage(&m, observer);
58 status_t __CORTEX_NAMESPACE__ remove_observer(
59 const BMessenger& observer,
60 const BMessenger& target) {
61 // ASSERT(observer.IsValid());
62 // ASSERT(target.IsValid());
64 BMessage m(M_REMOVE_OBSERVER);
65 m.AddMessenger("observer", observer);
66 return target.SendMessage(&m, observer);
69 // * Synchronous
71 status_t __CORTEX_NAMESPACE__ add_observer(
72 const BMessenger& observer,
73 const BMessenger& target,
74 BMessage& reply,
75 bigtime_t timeout) {
76 // ASSERT(observer.IsValid());
77 // ASSERT(target.IsValid());
79 BMessage m(M_ADD_OBSERVER);
80 m.AddMessenger("observer", observer);
81 return target.SendMessage(&m, &reply, timeout);
84 status_t __CORTEX_NAMESPACE__ remove_observer(
85 const BMessenger& observer,
86 const BMessenger& target,
87 BMessage& reply,
88 bigtime_t timeout) {
89 // ASSERT(observer.IsValid());
90 // ASSERT(target.IsValid());
92 BMessage m(M_REMOVE_OBSERVER);
93 m.AddMessenger("observer", observer);
94 return target.SendMessage(&m, &reply, timeout);
97 // END -- observe.cpp --