Porting windows manual-reset event to Linux?

后端 未结 7 1606
别那么骄傲
别那么骄傲 2020-11-30 05:23

Is there any easier solution in porting a windows manual-reset event to pthread, than a pthread conditional-variable + pthread mutex + a flag if event is set or unset?

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-30 05:40

    We (full disclosure: I work at NeoSmart Technologies) wrote an open source (MIT licensed) library called pevents which implements WIN32 manual and auto-reset events on POSIX, and includes both WaitForSingleObject and WaitForMultipleObjects clones. It's seen some adoption since then (it's used in Steam on Linux/Mac) and works fairly well.

    Although I'd personally advise you to use POSIX multithreading and signaling paradigms when coding on POSIX machines, pevents gives you another choice if you need it.

提交回复
热议问题