diff options
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/SCsub | 1 | ||||
-rw-r--r-- | platform/osx/detect.py | 10 | ||||
-rw-r--r-- | platform/osx/export/export.cpp | 16 | ||||
-rw-r--r-- | platform/osx/joypad_osx.cpp | 20 | ||||
-rw-r--r-- | platform/osx/joypad_osx.h | 3 | ||||
-rw-r--r-- | platform/osx/os_osx.h | 3 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 52 | ||||
-rw-r--r-- | platform/osx/semaphore_osx.cpp | 107 | ||||
-rw-r--r-- | platform/osx/semaphore_osx.h | 59 |
9 files changed, 56 insertions, 215 deletions
diff --git a/platform/osx/SCsub b/platform/osx/SCsub index d764ac4b50..0a4e0a45e1 100644 --- a/platform/osx/SCsub +++ b/platform/osx/SCsub @@ -9,7 +9,6 @@ files = [ 'crash_handler_osx.mm', 'os_osx.mm', 'godot_main_osx.mm', - 'semaphore_osx.cpp', 'dir_access_osx.mm', 'joypad_osx.cpp', 'vulkan_context_osx.mm', diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 0b164a2c56..b2f4032f66 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -151,18 +151,18 @@ def configure(env): env.Prepend(CPPPATH=['#platform/osx']) env.Append(CPPDEFINES=['OSX_ENABLED', 'UNIX_ENABLED', 'APPLE_STYLE_KEYS', 'COREAUDIO_ENABLED', 'COREMIDI_ENABLED']) - env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreMIDI', '-framework', 'IOKit', '-framework', 'ForceFeedback', '-framework', 'CoreVideo', '-framework', 'AVFoundation', '-framework', 'CoreMedia']) + env.AppendUnique(FRAMEWORKS=['Cocoa', 'Carbon', 'AudioUnit', 'CoreAudio', 'CoreMIDI', 'IOKit', 'ForceFeedback', 'CoreVideo', 'AVFoundation', 'CoreMedia']) env.Append(LIBS=['pthread', 'z']) env.Append(CPPDEFINES=['VULKAN_ENABLED']) - env.Append(LINKFLAGS=['-framework', 'Metal', '-framework', 'QuartzCore', '-framework', 'IOSurface']) + env.AppendUnique(FRAMEWORKS=['Metal', 'QuartzCore', 'IOSurface']) if (env['use_static_mvk']): - env.Append(LINKFLAGS=['-framework', 'MoltenVK']) + env.AppendUnique(FRAMEWORKS=['MoltenVK']) env['builtin_vulkan'] = False elif not env['builtin_vulkan']: env.Append(LIBS=['vulkan']) #env.Append(CPPDEFINES=['GLES_ENABLED', 'OPENGL_ENABLED']) - env.Append(CCFLAGS=['-mmacosx-version-min=10.11']) - env.Append(LINKFLAGS=['-mmacosx-version-min=10.11']) + env.Append(CCFLAGS=['-mmacosx-version-min=10.12']) + env.Append(LINKFLAGS=['-mmacosx-version-min=10.12']) diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 312987b8cb..dbe52da912 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -139,7 +139,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/timestamp"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/hardened_runtime"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "codesign/entitlements", PROPERTY_HINT_GLOBAL_FILE, "*.plist"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::POOL_STRING_ARRAY, "codesign/custom_options"), PoolStringArray())); + r_options->push_back(ExportOption(PropertyInfo(Variant::PACKED_STRING_ARRAY, "codesign/custom_options"), PackedStringArray())); #endif r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true)); @@ -147,7 +147,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false)); } -void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_source, Vector<uint8_t> &p_dest) { +void _rgba8_to_packbits_encode(int p_ch, int p_size, Vector<uint8_t> &p_source, Vector<uint8_t> &p_dest) { int src_len = p_size * p_size; @@ -160,11 +160,11 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour int i = 0; while (i < src_len) { - uint8_t cur = p_source.read()[i * 4 + p_ch]; + uint8_t cur = p_source.ptr()[i * 4 + p_ch]; if (i < src_len - 2) { - if ((p_source.read()[(i + 1) * 4 + p_ch] == cur) && (p_source.read()[(i + 2) * 4 + p_ch] == cur)) { + if ((p_source.ptr()[(i + 1) * 4 + p_ch] == cur) && (p_source.ptr()[(i + 2) * 4 + p_ch] == cur)) { if (buf_size > 0) { result.write[res_size++] = (uint8_t)(buf_size - 1); copymem(&result.write[res_size], &buf, buf_size); @@ -176,7 +176,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour bool hit_lim = true; for (int j = 3; j <= lim; j++) { - if (p_source.read()[(i + j) * 4 + p_ch] != cur) { + if (p_source.ptr()[(i + j) * 4 + p_ch] != cur) { hit_lim = false; i = i + j - 1; result.write[res_size++] = (uint8_t)(j - 3 + 0x80); @@ -278,7 +278,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_ DirAccess::remove_file_or_error(path); } else { - PoolVector<uint8_t> src_data = copy->get_data(); + Vector<uint8_t> src_data = copy->get_data(); //encode 24bit RGB RLE icon { @@ -302,7 +302,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_ data.resize(data.size() + len + 8); for (int j = 0; j < len; j++) { - data.write[ofs + 8 + j] = src_data.read()[j * 4 + 3]; + data.write[ofs + 8 + j] = src_data.ptr()[j * 4 + 3]; } len += 8; len = BSWAP32(len); @@ -386,7 +386,7 @@ Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_prese args.push_back(p_preset->get("codesign/entitlements")); } - PoolStringArray user_args = p_preset->get("codesign/custom_options"); + PackedStringArray user_args = p_preset->get("codesign/custom_options"); for (int i = 0; i < user_args.size(); i++) { String user_arg = user_args[i].strip_edges(); if (!user_arg.empty()) { diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index 13ece678f3..e9f46fb5a4 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -208,9 +208,8 @@ void joypad::add_hid_elements(CFArrayRef p_array) { CFArrayApplyFunction(p_array, range, hid_element_added, this); } -static void joypad_removed_callback(void *ctx, IOReturn result, void *sender) { - int id = (intptr_t)ctx; - self->_device_removed(id); +static void joypad_removed_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) { + self->_device_removed(res, ioHIDDeviceObject); } static void joypad_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) { @@ -261,16 +260,15 @@ void JoypadOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) { #endif device_list.push_back(new_joypad); } - IOHIDDeviceRegisterRemovalCallback(p_device, joypad_removed_callback, (void *)(intptr_t)new_joypad.id); IOHIDDeviceScheduleWithRunLoop(p_device, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE); } -void JoypadOSX::_device_removed(int p_id) { +void JoypadOSX::_device_removed(IOReturn p_res, IOHIDDeviceRef p_device) { - int device = get_joy_index(p_id); + int device = get_joy_ref(p_device); ERR_FAIL_COND(device == -1); - input->joy_connection_changed(p_id, false, ""); + input->joy_connection_changed(device_list[device].id, false, ""); device_list.write[device].free(); device_list.remove(device); } @@ -516,6 +514,13 @@ int JoypadOSX::get_joy_index(int p_id) const { return -1; } +int JoypadOSX::get_joy_ref(IOHIDDeviceRef p_device) const { + for (int i = 0; i < device_list.size(); i++) { + if (device_list[i].device_ref == p_device) return i; + } + return -1; +} + bool JoypadOSX::have_device(IOHIDDeviceRef p_device) const { for (int i = 0; i < device_list.size(); i++) { if (device_list[i].device_ref == p_device) { @@ -558,6 +563,7 @@ void JoypadOSX::config_hid_manager(CFArrayRef p_matching_array) const { IOHIDManagerSetDeviceMatchingMultiple(hid_manager, p_matching_array); IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joypad_added_callback, NULL); + IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, joypad_removed_callback, NULL); IOHIDManagerScheduleWithRunLoop(hid_manager, runloop, GODOT_JOY_LOOP_RUN_MODE); while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE, 0, TRUE) == kCFRunLoopRunHandledSource) { diff --git a/platform/osx/joypad_osx.h b/platform/osx/joypad_osx.h index 388251016b..2c076b3680 100644 --- a/platform/osx/joypad_osx.h +++ b/platform/osx/joypad_osx.h @@ -103,6 +103,7 @@ private: bool configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy); int get_joy_index(int p_id) const; + int get_joy_ref(IOHIDDeviceRef p_device) const; void poll_joypads() const; void setup_joypad_objects(); @@ -115,7 +116,7 @@ public: void process_joypads(); void _device_added(IOReturn p_res, IOHIDDeviceRef p_device); - void _device_removed(int p_id); + void _device_removed(IOReturn p_res, IOHIDDeviceRef p_device); JoypadOSX(); ~JoypadOSX(); diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 75a56bd82c..3140d9bac4 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -69,7 +69,8 @@ public: bool pressed; bool echo; bool raw; - uint32_t scancode; + uint32_t keycode; + uint32_t physical_keycode; uint32_t unicode; }; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index ca29c95f57..4c70beee00 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -44,7 +44,6 @@ #endif #include "main/main.h" -#include "semaphore_osx.h" #include "servers/visual/visual_server_raster.h" #include "servers/visual/visual_server_wrap_mt.h" @@ -157,7 +156,8 @@ static NSCursor *cursorFromSelector(SEL selector, SEL fallback = nil) { get_key_modifier_state([event modifierFlags], k); k->set_pressed(true); - k->set_scancode(KEY_PERIOD); + k->set_keycode(KEY_PERIOD); + k->set_physical_keycode(KEY_PERIOD); k->set_echo([event isARepeat]); OS_OSX::singleton->push_input(k); @@ -635,7 +635,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; ke.pressed = true; ke.echo = false; ke.raw = false; // IME input event - ke.scancode = 0; + ke.keycode = 0; + ke.physical_keycode = 0; ke.unicode = codepoint; push_to_key_event_buffer(ke); @@ -747,7 +748,7 @@ static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) { const Vector2 pos = get_mouse_pos([event locationInWindow], backingScaleFactor); mm->set_position(pos); mm->set_pressure([event pressure]); - if ([event subtype] == NSTabletPointEventSubtype) { + if ([event subtype] == NSEventSubtypeTabletPoint) { const NSPoint p = [event tilt]; mm->set_tilt(Vector2(p.x, p.y)); } @@ -1158,7 +1159,8 @@ static int remapKey(unsigned int key, unsigned int state) { ke.osx_state = [event modifierFlags]; ke.pressed = true; ke.echo = [event isARepeat]; - ke.scancode = remapKey([event keyCode], [event modifierFlags]); + ke.keycode = remapKey([event keyCode], [event modifierFlags]); + ke.physical_keycode = translateKey([event keyCode]); ke.raw = true; ke.unicode = [characters characterAtIndex:i]; @@ -1170,7 +1172,8 @@ static int remapKey(unsigned int key, unsigned int state) { ke.osx_state = [event modifierFlags]; ke.pressed = true; ke.echo = [event isARepeat]; - ke.scancode = remapKey([event keyCode], [event modifierFlags]); + ke.keycode = remapKey([event keyCode], [event modifierFlags]); + ke.physical_keycode = translateKey([event keyCode]); ke.raw = false; ke.unicode = 0; @@ -1228,7 +1231,8 @@ static int remapKey(unsigned int key, unsigned int state) { } ke.osx_state = mod; - ke.scancode = remapKey(key, mod); + ke.keycode = remapKey(key, mod); + ke.physical_keycode = translateKey(key); ke.unicode = 0; push_to_key_event_buffer(ke); @@ -1250,7 +1254,8 @@ static int remapKey(unsigned int key, unsigned int state) { ke.osx_state = [event modifierFlags]; ke.pressed = false; ke.echo = [event isARepeat]; - ke.scancode = remapKey([event keyCode], [event modifierFlags]); + ke.keycode = remapKey([event keyCode], [event modifierFlags]); + ke.physical_keycode = translateKey([event keyCode]); ke.raw = true; ke.unicode = [characters characterAtIndex:i]; @@ -1262,7 +1267,8 @@ static int remapKey(unsigned int key, unsigned int state) { ke.osx_state = [event modifierFlags]; ke.pressed = false; ke.echo = [event isARepeat]; - ke.scancode = remapKey([event keyCode], [event modifierFlags]); + ke.keycode = remapKey([event keyCode], [event modifierFlags]); + ke.physical_keycode = translateKey([event keyCode]); ke.raw = true; ke.unicode = 0; @@ -1457,8 +1463,6 @@ void OS_OSX::initialize_core() { DirAccess::make_default<DirAccessOSX>(DirAccess::ACCESS_RESOURCES); DirAccess::make_default<DirAccessOSX>(DirAccess::ACCESS_USERDATA); DirAccess::make_default<DirAccessOSX>(DirAccess::ACCESS_FILESYSTEM); - - SemaphoreOSX::make_default(); } static bool keyboard_layout_dirty = true; @@ -1757,7 +1761,7 @@ void OS_OSX::alert(const String &p_alert, const String &p_title) { [window addButtonWithTitle:@"OK"]; [window setMessageText:ns_title]; [window setInformativeText:ns_alert]; - [window setAlertStyle:NSWarningAlertStyle]; + [window setAlertStyle:NSAlertStyleWarning]; // Display it, then release [window runModal]; @@ -1892,10 +1896,6 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c uint8_t *pixels = [imgrep bitmapData]; int len = int(texture_size.width * texture_size.height); - PoolVector<uint8_t> data = image->get_data(); - PoolVector<uint8_t>::Read r = data.read(); - - image->lock(); for (int i = 0; i < len; i++) { int row_index = floor(i / texture_size.width) + atlas_rect.position.y; @@ -1915,8 +1915,6 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c pixels[i * 4 + 3] = alpha; } - image->unlock(); - NSImage *nsimage = [[NSImage alloc] initWithSize:NSMakeSize(texture_size.width, texture_size.height)]; [nsimage addRepresentation:imgrep]; @@ -2051,8 +2049,7 @@ void OS_OSX::set_icon(const Ref<Image> &p_icon) { uint8_t *pixels = [imgrep bitmapData]; int len = img->get_width() * img->get_height(); - PoolVector<uint8_t> data = img->get_data(); - PoolVector<uint8_t>::Read r = data.read(); + const uint8_t *r = img->get_data().ptr(); /* Premultiply the alpha channel */ for (int i = 0; i < len; i++) { @@ -2852,32 +2849,35 @@ void OS_OSX::process_key_events() { get_key_modifier_state(ke.osx_state, k); k->set_pressed(ke.pressed); k->set_echo(ke.echo); - k->set_scancode(ke.scancode); + k->set_keycode(ke.keycode); + k->set_physical_keycode(ke.physical_keycode); k->set_unicode(ke.unicode); push_input(k); } else { // IME input - if ((i == 0 && ke.scancode == 0) || (i > 0 && key_event_buffer[i - 1].scancode == 0)) { + if ((i == 0 && ke.keycode == 0) || (i > 0 && key_event_buffer[i - 1].keycode == 0)) { k.instance(); get_key_modifier_state(ke.osx_state, k); k->set_pressed(ke.pressed); k->set_echo(ke.echo); - k->set_scancode(0); + k->set_keycode(0); + k->set_physical_keycode(0); k->set_unicode(ke.unicode); push_input(k); } - if (ke.scancode != 0) { + if (ke.keycode != 0) { k.instance(); get_key_modifier_state(ke.osx_state, k); k->set_pressed(ke.pressed); k->set_echo(ke.echo); - k->set_scancode(ke.scancode); + k->set_keycode(ke.keycode); + k->set_physical_keycode(ke.physical_keycode); - if (i + 1 < key_event_pos && key_event_buffer[i + 1].scancode == 0) { + if (i + 1 < key_event_pos && key_event_buffer[i + 1].keycode == 0) { k->set_unicode(key_event_buffer[i + 1].unicode); } diff --git a/platform/osx/semaphore_osx.cpp b/platform/osx/semaphore_osx.cpp deleted file mode 100644 index e4e5991637..0000000000 --- a/platform/osx/semaphore_osx.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/*************************************************************************/ -/* semaphore_osx.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "semaphore_osx.h" - -#include <fcntl.h> -#include <unistd.h> - -void cgsem_init(cgsem_t *cgsem) { - int flags, fd, i; - - pipe(cgsem->pipefd); - - /* Make the pipes FD_CLOEXEC to allow them to close should we call - * execv on restart. */ - for (i = 0; i < 2; i++) { - fd = cgsem->pipefd[i]; - flags = fcntl(fd, F_GETFD, 0); - flags |= FD_CLOEXEC; - fcntl(fd, F_SETFD, flags); - } -} - -void cgsem_post(cgsem_t *cgsem) { - const char buf = 1; - - write(cgsem->pipefd[1], &buf, 1); -} - -void cgsem_wait(cgsem_t *cgsem) { - char buf; - - read(cgsem->pipefd[0], &buf, 1); -} - -void cgsem_destroy(cgsem_t *cgsem) { - close(cgsem->pipefd[1]); - close(cgsem->pipefd[0]); -} - -#include "core/os/memory.h" - -#include <errno.h> - -Error SemaphoreOSX::wait() { - - cgsem_wait(&sem); - return OK; -} - -Error SemaphoreOSX::post() { - - cgsem_post(&sem); - - return OK; -} -int SemaphoreOSX::get() const { - - return 0; -} - -SemaphoreOld *SemaphoreOSX::create_semaphore_osx() { - - return memnew(SemaphoreOSX); -} - -void SemaphoreOSX::make_default() { - - create_func = create_semaphore_osx; -} - -SemaphoreOSX::SemaphoreOSX() { - - cgsem_init(&sem); -} - -SemaphoreOSX::~SemaphoreOSX() { - - cgsem_destroy(&sem); -} diff --git a/platform/osx/semaphore_osx.h b/platform/osx/semaphore_osx.h deleted file mode 100644 index 9aa2b47bc8..0000000000 --- a/platform/osx/semaphore_osx.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************/ -/* semaphore_osx.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef SEMAPHORE_OSX_H -#define SEMAPHORE_OSX_H - -struct cgsem { - int pipefd[2]; -}; - -typedef struct cgsem cgsem_t; - -#include "core/os/semaphore.h" - -class SemaphoreOSX : public SemaphoreOld { - - mutable cgsem_t sem; - - static SemaphoreOld *create_semaphore_osx(); - -public: - virtual Error wait(); - virtual Error post(); - virtual int get() const; - - static void make_default(); - SemaphoreOSX(); - - ~SemaphoreOSX(); -}; - -#endif // SEMAPHORE_OSX_H |