1b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org/* 2b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 3b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * 4b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * Use of this source code is governed by a BSD-style license 5b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * that can be found in the LICENSE file in the root of the source 6b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * tree. An additional intellectual property rights grant can be found 7b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * in the file PATENTS. All contributing project authors may 8b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * be found in the AUTHORS file in the root of the source tree. 9b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org */ 10b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 116e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org#include "webrtc/system_wrappers/interface/condition_variable_wrapper.h" 126e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org 13b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#if defined(_WIN32) 1487beb441ccf697d1f2677ceaccde7fc153c6fdd9phoglund@webrtc.org#include <windows.h> 156e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org#include "webrtc/system_wrappers/source/condition_variable_event_win.h" 166e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org#include "webrtc/system_wrappers/source/condition_variable_native_win.h" 1787beb441ccf697d1f2677ceaccde7fc153c6fdd9phoglund@webrtc.org#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) 1887beb441ccf697d1f2677ceaccde7fc153c6fdd9phoglund@webrtc.org#include <pthread.h> 196e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org#include "webrtc/system_wrappers/source/condition_variable_posix.h" 20b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#endif 21b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 22b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgnamespace webrtc { 2387beb441ccf697d1f2677ceaccde7fc153c6fdd9phoglund@webrtc.org 2487beb441ccf697d1f2677ceaccde7fc153c6fdd9phoglund@webrtc.orgConditionVariableWrapper* ConditionVariableWrapper::CreateConditionVariable() { 25b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#if defined(_WIN32) 266e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org // Try to create native condition variable implementation. 276e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org ConditionVariableWrapper* ret_val = ConditionVariableNativeWin::Create(); 286e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org if (!ret_val) { 296e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org // Native condition variable implementation does not exist. Create generic 306e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org // condition variable based on events. 316e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org ret_val = new ConditionVariableEventWin(); 326e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org } 336e34ceb97c11f4d390742a8364e77a65b8a01200henrike@webrtc.org return ret_val; 34b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) 3587beb441ccf697d1f2677ceaccde7fc153c6fdd9phoglund@webrtc.org return ConditionVariablePosix::Create(); 36b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#else 3787beb441ccf697d1f2677ceaccde7fc153c6fdd9phoglund@webrtc.org return NULL; 38b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#endif 39b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org} 4087beb441ccf697d1f2677ceaccde7fc153c6fdd9phoglund@webrtc.org 413b89e10f31160da35b408fd00cb8f89d2b08862dpbos@webrtc.org} // namespace webrtc 42