{"id":3387,"date":"2015-07-21T05:29:18","date_gmt":"2015-07-21T10:29:18","guid":{"rendered":"http:\/\/neosmart.net\/blog\/?p=3387"},"modified":"2015-07-21T05:29:18","modified_gmt":"2015-07-21T10:29:18","slug":"pevents-a-cross-platform-win32-events-library","status":"publish","type":"post","link":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/","title":{"rendered":"pevents: a cross-platform Win32 events library"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/neosmart\/pevents\" rel=\"nofollow\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright  wp-image-3393 colorbox-3387\" src=\"\/blog\/wp-content\/uploads\/Threads-GitHub.jpg\" alt=\"Threads-GitHub\" width=\"167\" height=\"167\" srcset=\"https:\/\/neosmart.net\/blog\/wp-content\/uploads\/Threads-GitHub.jpg 200w, https:\/\/neosmart.net\/blog\/wp-content\/uploads\/Threads-GitHub-150x150.jpg 150w\" sizes=\"auto, (max-width: 167px) 100vw, 167px\" \/><\/a>pevents, our implementation of Windows manual- and auto-reset events for Mac and Linux, is now officially pevents, our truly cross-platform win32 lightweight events library for Windows, Mac, Linux, and other platforms.\u00a0<a href=\"https:\/\/neosmart.net\/blog\/2011\/waitformultipleobjects-and-win32-events-for-linux-and-read-write-locks-for-windows\/\" rel=\"follow\">We first released pevents<\/a> way back in 2011, when we searched for and were unable to find an existing implementation of Windows events, the basic primitives for thread synchronization on Win32.<\/p>\n<p>The *nix world has seen a lot of progress when it comes to non-blocking waits in recent years, but it&#8217;s very recently that purely event-driven libraries like epoll and kqueue have properly taken off. In the Windows world, it&#8217;s long-been possible to wait on filesystem and network events with <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/ms687028(v=vs.85).aspx\" rel=\"follow\"><code>WaitForMultipleObjects<\/code><\/a>\u00a0&#8211; a paradigm most Windows C\/C++ developers are intimately familiar with. One thing that <code>WaitForMultipleObjects<\/code> (and pevents!) can also do rather neatly is wait on multiple mutexes,\u00a0events, and\/or semaphores simultaneously, unblocking when one or more (or all) are triggered or available.<\/p>\n<p><!--more--><\/p>\n<p>Something similar can be accomplished on Linux\/Mac\u00a0using posix condition variables and mutexes \u2013 but for developers more-accustomed to Windows auto or manual reset events and <code>WaitForSingleObjectEx<\/code> or <code>WaitForMultipleObjectsEx<\/code>, it can be difficult to make the jump. More importantly, code must be written from the ground-up to either use the WFMO or the condition variable pattern &#8211; meaning developers often face\u00a0a very hard time porting multi-threaded code from Windows to Linux and other posix platforms like Android and iOS (or vice-versa) without a complete rewrite of all thread synchronization.<\/p>\n<p>Enter pevents: a small, light library that implements Windows autoreset and manual-reset events on top of pthreads, and exposes the same API on Windows, Linux, and Mac. With this update, pevents officially supports Windows too, serving as a proxy for the native <code>CreateEvent<\/code>, <code>SetEvent<\/code>, <code>ResetEvent<\/code>, <code>PulseEvent<\/code>, <code>WaitForSingleObject<\/code>, and <code>WaitForMultipleObjects<\/code> functions. Developers are no longer required to surround all multithreading code with #ifdef to support both Windows and *nix multithreading from a single codebase.<\/p>\n<p><a href=\"https:\/\/github.com\/neosmart\/pevents\/\" rel=\"nofollow\">pevents<\/a> is 100% open source, available\u00a0under the terms of the liberal MIT license. It&#8217;s straight-forward and easy to use for anyone that&#8217;s previously used Windows events, and has been used by a number of larger teams and projects in the years since its release to great success. It&#8217;s available to pull and fork on GitHub &#8211; join in!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>pevents, our implementation of Windows manual- and auto-reset events for Mac and Linux, is now officially pevents, our truly cross-platform win32 lightweight events library for Windows, Mac, Linux, and other platforms.\u00a0We first released pevents way back in 2011, when we &hellip; <a href=\"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":505,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1],"tags":[325,759,899,898,11],"class_list":["post-3387","post","type-post","status-publish","format-standard","hentry","category-software","tag-c","tag-github","tag-mulithreading","tag-pevents","tag-programming"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"pevents, our implementation of Windows manual- and auto-reset events for Mac and Linux, is now officially pevents, our truly cross-platform win32 lightweight events library for Windows, Mac, Linux, and other platforms. We first released pevents way back in 2011, when we searched for and were unable to find an existing implementation of Windows events, the basic\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Mahmoud Al-Qudsi\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/pevents-a-cross-platform-win32-events-library\\\/#article\",\"name\":\"pevents: a cross-platform Win32 events library | The NeoSmart Files\",\"headline\":\"pevents: a cross-platform Win32 events library\",\"author\":{\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/author\\\/mqudsi\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"\\\/blog\\\/wp-content\\\/uploads\\\/Threads-GitHub.jpg\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/pevents-a-cross-platform-win32-events-library\\\/#articleImage\"},\"datePublished\":\"2015-07-21T05:29:18-05:00\",\"dateModified\":\"2015-07-21T05:29:18-05:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/pevents-a-cross-platform-win32-events-library\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/pevents-a-cross-platform-win32-events-library\\\/#webpage\"},\"articleSection\":\"Software, c#, github, mulithreading, pevents, programming\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/pevents-a-cross-platform-win32-events-library\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/category\\\/software\\\/#listItem\",\"name\":\"Software\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/category\\\/software\\\/#listItem\",\"position\":2,\"name\":\"Software\",\"item\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/category\\\/software\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/pevents-a-cross-platform-win32-events-library\\\/#listItem\",\"name\":\"pevents: a cross-platform Win32 events library\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/pevents-a-cross-platform-win32-events-library\\\/#listItem\",\"position\":3,\"name\":\"pevents: a cross-platform Win32 events library\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/category\\\/software\\\/#listItem\",\"name\":\"Software\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/#organization\",\"name\":\"The NeoSmart Files\",\"description\":\"Recovery software and more\",\"url\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/author\\\/mqudsi\\\/#author\",\"url\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/author\\\/mqudsi\\\/\",\"name\":\"Mahmoud Al-Qudsi\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/pevents-a-cross-platform-win32-events-library\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c2643dd7c6df61aed49d9f3d917ac6d61cafbbda5f9b1619f50d3b749dca415a?s=96&d=mm&r=pg\",\"width\":96,\"height\":96,\"caption\":\"Mahmoud Al-Qudsi\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/pevents-a-cross-platform-win32-events-library\\\/#webpage\",\"url\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/pevents-a-cross-platform-win32-events-library\\\/\",\"name\":\"pevents: a cross-platform Win32 events library | The NeoSmart Files\",\"description\":\"pevents, our implementation of Windows manual- and auto-reset events for Mac and Linux, is now officially pevents, our truly cross-platform win32 lightweight events library for Windows, Mac, Linux, and other platforms. We first released pevents way back in 2011, when we searched for and were unable to find an existing implementation of Windows events, the basic\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/pevents-a-cross-platform-win32-events-library\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/author\\\/mqudsi\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/author\\\/mqudsi\\\/#author\"},\"datePublished\":\"2015-07-21T05:29:18-05:00\",\"dateModified\":\"2015-07-21T05:29:18-05:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/\",\"name\":\"The NeoSmart Files\",\"description\":\"Recovery software and more\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/neosmart.net\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"pevents: a cross-platform Win32 events library | The NeoSmart Files","description":"pevents, our implementation of Windows manual- and auto-reset events for Mac and Linux, is now officially pevents, our truly cross-platform win32 lightweight events library for Windows, Mac, Linux, and other platforms. We first released pevents way back in 2011, when we searched for and were unable to find an existing implementation of Windows events, the basic","canonical_url":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/#article","name":"pevents: a cross-platform Win32 events library | The NeoSmart Files","headline":"pevents: a cross-platform Win32 events library","author":{"@id":"https:\/\/neosmart.net\/blog\/author\/mqudsi\/#author"},"publisher":{"@id":"https:\/\/neosmart.net\/blog\/#organization"},"image":{"@type":"ImageObject","url":"\/blog\/wp-content\/uploads\/Threads-GitHub.jpg","@id":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/#articleImage"},"datePublished":"2015-07-21T05:29:18-05:00","dateModified":"2015-07-21T05:29:18-05:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/#webpage"},"isPartOf":{"@id":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/#webpage"},"articleSection":"Software, c#, github, mulithreading, pevents, programming"},{"@type":"BreadcrumbList","@id":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/neosmart.net\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/neosmart.net\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/neosmart.net\/blog\/category\/software\/#listItem","name":"Software"}},{"@type":"ListItem","@id":"https:\/\/neosmart.net\/blog\/category\/software\/#listItem","position":2,"name":"Software","item":"https:\/\/neosmart.net\/blog\/category\/software\/","nextItem":{"@type":"ListItem","@id":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/#listItem","name":"pevents: a cross-platform Win32 events library"},"previousItem":{"@type":"ListItem","@id":"https:\/\/neosmart.net\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/#listItem","position":3,"name":"pevents: a cross-platform Win32 events library","previousItem":{"@type":"ListItem","@id":"https:\/\/neosmart.net\/blog\/category\/software\/#listItem","name":"Software"}}]},{"@type":"Organization","@id":"https:\/\/neosmart.net\/blog\/#organization","name":"The NeoSmart Files","description":"Recovery software and more","url":"https:\/\/neosmart.net\/blog\/"},{"@type":"Person","@id":"https:\/\/neosmart.net\/blog\/author\/mqudsi\/#author","url":"https:\/\/neosmart.net\/blog\/author\/mqudsi\/","name":"Mahmoud Al-Qudsi","image":{"@type":"ImageObject","@id":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/c2643dd7c6df61aed49d9f3d917ac6d61cafbbda5f9b1619f50d3b749dca415a?s=96&d=mm&r=pg","width":96,"height":96,"caption":"Mahmoud Al-Qudsi"}},{"@type":"WebPage","@id":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/#webpage","url":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/","name":"pevents: a cross-platform Win32 events library | The NeoSmart Files","description":"pevents, our implementation of Windows manual- and auto-reset events for Mac and Linux, is now officially pevents, our truly cross-platform win32 lightweight events library for Windows, Mac, Linux, and other platforms. We first released pevents way back in 2011, when we searched for and were unable to find an existing implementation of Windows events, the basic","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/neosmart.net\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/#breadcrumblist"},"author":{"@id":"https:\/\/neosmart.net\/blog\/author\/mqudsi\/#author"},"creator":{"@id":"https:\/\/neosmart.net\/blog\/author\/mqudsi\/#author"},"datePublished":"2015-07-21T05:29:18-05:00","dateModified":"2015-07-21T05:29:18-05:00"},{"@type":"WebSite","@id":"https:\/\/neosmart.net\/blog\/#website","url":"https:\/\/neosmart.net\/blog\/","name":"The NeoSmart Files","description":"Recovery software and more","inLanguage":"en-US","publisher":{"@id":"https:\/\/neosmart.net\/blog\/#organization"}}]}},"aioseo_meta_data":{"post_id":"3387","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-23 20:07:55","updated":"2026-01-10 22:12:53","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/neosmart.net\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/neosmart.net\/blog\/category\/software\/\" title=\"Software\">Software<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tpevents: a cross-platform Win32 events library\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/neosmart.net\/blog\/"},{"label":"Software","link":"https:\/\/neosmart.net\/blog\/category\/software\/"},{"label":"pevents: a cross-platform Win32 events library","link":"https:\/\/neosmart.net\/blog\/pevents-a-cross-platform-win32-events-library\/"}],"jetpack_shortlink":"https:\/\/wp.me\/p4xDa-SD","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/posts\/3387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/users\/505"}],"replies":[{"embeddable":true,"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/comments?post=3387"}],"version-history":[{"count":7,"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/posts\/3387\/revisions"}],"predecessor-version":[{"id":3396,"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/posts\/3387\/revisions\/3396"}],"wp:attachment":[{"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/media?parent=3387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/categories?post=3387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/neosmart.net\/blog\/wp-json\/wp\/v2\/tags?post=3387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}