- (oneway void)release;
무슨 말인지 찾아보니 "The Objective-C 2.0 Programming Language" PDF 파일에
"Synchronous and Asynchronous MessagesConsider first a method with just a simple return value:- (BOOL)canDance;When a canDance message is sent to a receiver in the same application, the method is invoked and thereturn value provided directly to the sender. But when the receiver is in a remote application, two underlyingmessages are required—one message to get the remote object to invoke the method, and the other messageto send back the result of the remote calculation. This is illustrated in the figure below:<Figure 12-2>Most remote messages are, at bottom, two-way (or “round trip”) remote procedure calls (RPCs) like this one.The sending application waits for the receiving application to invoke the method, complete its processing,and send back an indication that it has finished, along with any return information requested. Waiting forthe receiver to finish, even if no information is returned, has the advantage of coordinating the twocommunicating applications, of keeping them both “in sync.” For this reason, round-trip messages are oftencalled synchronous. Synchronous messages are the default.However, it’s not always necessary or a good idea to wait for a reply. Sometimes it’s sufficient simply todispatch the remote message and return, allowing the receiver to get to the task when it can. In the meantime,the sender can go on to other things. Objective-C provides a return type modifier, oneway, to indicate thata method is used only for asynchronous messages:- (oneway void)waltzAtWill;Although oneway is a type qualifier (like const) and can be used in combination with a specific type name,such as oneway float or oneway id, the only such combination that makes any sense is oneway void.An asynchronous message can’t have a valid return value."
라고 되어 있습니다.
요 글에 의하면 일반적으로 Objective-c 에서 remote에 있는 receiver에게 message를 전달하는 방식은 synchronous 방식이라고 합니다. 즉, 메서드를 호출하면 return 결과를 받을 때 까지 멈춘다(blocking) 이거죠.
하지만 굳이 remote 호출 시 대기 할 필요가 없는 메서드는 asynchronous 하게 호출하도록 할 수 있습니다.
이럴 때 사용되는 keyword가 oneway이며, 위의 release와 같은 경우 asynchronous 하게 호출된다고 할 수 있겠습니다.
RPC를 통한 remote 호출을 해본적이 없어서 자세한 예는 들기 힘드네요. 나중에 호출해볼 수 있는 좋은 기회가 있었으면~
Posted by 장현준


