1// Copyright 2016 The Fuchsia Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include <lib/zx/eventpair.h> 6 7#include <zircon/syscalls.h> 8 9namespace zx { 10 11zx_status_t eventpair::create(uint32_t flags, eventpair* endpoint0, 12 eventpair* endpoint1) { 13 // Ensure aliasing of both out parameters to the same container 14 // has a well-defined result, and does not leak. 15 eventpair h0; 16 eventpair h1; 17 zx_status_t status = zx_eventpair_create( 18 flags, h0.reset_and_get_address(), 19 h1.reset_and_get_address()); 20 endpoint0->reset(h0.release()); 21 endpoint1->reset(h1.release()); 22 return status; 23} 24 25} // namespace zx 26