PageRenderTime 19ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/google-toolbox-for-mac/Foundation/GTMTransientRootPortProxy.h

http://macfuse.googlecode.com/
C++ Header | 50 lines | 18 code | 5 blank | 27 comment | 0 complexity | 2133240365f0d9ba773556cfc36a1a5b MD5 | raw file
 1//
 2//  GTMTransientRootPortProxy.h
 3//
 4//  Copyright 2006-2009 Google Inc.
 5//
 6//  Licensed under the Apache License, Version 2.0 (the "License"); you may not
 7//  use this file except in compliance with the License.  You may obtain a copy
 8//  of the License at
 9//
10//  http://www.apache.org/licenses/LICENSE-2.0
11//
12//  Unless required by applicable law or agreed to in writing, software
13//  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14//  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
15//  License for the specific language governing permissions and limitations under
16//  the License.
17//
18
19#import <Foundation/Foundation.h>
20#import "GTMTransientRootProxy.h"
21
22@interface GTMTransientRootPortProxy : GTMTransientRootProxy {
23 @private
24  NSPort *receivePort_;
25  NSPort *sendPort_;
26}
27
28// Returns an autoreleased instance. See below for details on args.
29+ (id)rootProxyWithReceivePort:(NSPort *)receivePort
30                      sendPort:(NSPort *)sendPort
31                      protocol:(Protocol *)protocol
32                requestTimeout:(NSTimeInterval)requestTimeout
33                  replyTimeout:(NSTimeInterval)replyTimeout;
34
35// This function will return a GTMTransientRootProxy that is using NSPorts
36// for the connection. The |receivePort| and |sendPort| conventions
37// follow the same conventions as -[NSConnection initWithReceivePort:sendPort:].
38// Note that due to Radar 6676818 "NSConnection leaks when initialized with nil
39// sendPort" that you will leak a connection if you pass in "nil" for your
40// sendPort if you are using NSPorts (mach or socket) to communicate between
41// threads. The leak occurs on 10.5.6, and SL 10A286. This simple answer
42// is just to always use two ports to communicate. Check out the test to see
43// how we do cross thread communication.
44- (id)initWithReceivePort:(NSPort *)receivePort
45                 sendPort:(NSPort *)sendPort
46                 protocol:(Protocol *)protocol
47           requestTimeout:(NSTimeInterval)requestTimeout
48             replyTimeout:(NSTimeInterval)replyTimeout;
49
50@end