aboutsummaryrefslogtreecommitdiff
path: root/src/threading/semaphore.h
Commit message (Collapse)AuthorAge
* Code modernization: subfolders (#6283)Loïc Blot2017-08-19
| | | | | | | | | | | | | * Code modernization: subfolders Modernize various code on subfolders client, network, script, threading, unittests, util * empty function * default constructor/destructor * for range-based loops * use emplace_back instead of push_back * C++ STL header style * Make connection.cpp readable in a pointed place + typo
* C++ modernize: Pragma once (#6264)Loïc Blot2017-08-17
| | | | * Migrate cpp headers to pragma once
* Pass clang-format on 14 trivial header files fixesLoic Blot2017-04-07
| | | | Also remove them from whitelist
* Rename and move basicmacros.h to util/basic_macros.hest312015-11-02
|
* Add DISABLE_CLASS_COPY macro (and use it)kwolekr2015-10-27
| | | | | | | | | Use this macro to disallow copying of an object using the assignment operator or copy constructor. This catches otherwise silent-but-deadly mistakes such as "ServerMap map = env->getMap();" at compile time. If so desired, it is still possible to copy a class, but it now requires an explicit call to memcpy or std::copy.
* Clean up threadingShadowNinja2015-08-23
* Rename everything. * Strip J prefix. * Change UpperCamelCase functions to lowerCamelCase. * Remove global (!) semaphore count mutex on OSX. * Remove semaphore count getter (unused, unsafe, depended on internal API functions on Windows, and used a hack on OSX). * Add `Atomic<type>`. * Make `Thread` handle thread names. * Add support for C++11 multi-threading. * Combine pthread and win32 sources. * Remove `ThreadStarted` (unused, unneeded). * Move some includes from the headers to the sources. * Move all of `Event` into its header (allows inlining with no new includes). * Make `Event` use `Semaphore` (except on Windows). * Move some porting functions into `Thread`. * Integrate logging with `Thread`. * Add threading test.
ass="hl opt">::rect<s32>(0,0,100,100)) { m_active_menu_count = active_menu_count; m_allow_focus_removal = false; m_screensize_old = v2u32(0,0); setVisible(true); Environment->setFocus(this); (*m_active_menu_count)++; } virtual ~GUIModalMenu() { (*m_active_menu_count)--; } bool canTakeFocus(gui::IGUIElement *e) { return (e && (e == this || isMyChild(e))) || m_allow_focus_removal; } void draw() { if(!IsVisible) return; video::IVideoDriver* driver = Environment->getVideoDriver(); v2u32 screensize = driver->getScreenSize(); if(screensize != m_screensize_old) { m_screensize_old = screensize; regenerateGui(screensize); } drawMenu(); } /* This should be called when the menu wants to quit */ void quitMenu() { m_allow_focus_removal = true; // This removes Environment's grab on us Environment->removeFocus(this); this->remove(); } virtual void regenerateGui(v2u32 screensize) = 0; virtual void drawMenu() = 0; virtual bool OnEvent(const SEvent& event) { return false; }; private: int *m_active_menu_count; // This might be necessary to expose to the implementation if it // wants to launch other menus bool m_allow_focus_removal; v2u32 m_screensize_old; }; #endif