Title: asyncio/OpenBSD: make concurrent.futures dependency optional
Type: Stage:
Components: Versions:
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, rpointel, vstinner
Priority: normal Keywords: patch

Created on 2014-02-17 23:42 by vstinner, last changed 2014-02-18 08:17 by vstinner. This issue is now closed.

File name Uploaded Description Edit
synchronous_executor.patch vstinner, 2014-02-17 23:42 review
Messages (4)
msg211457 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-02-17 23:42
On old FreeBSD versions and on the latest OpenBSD (5.4), the multiprocessing module is not available because POSIX semaphores are not supported by the OS. See issues #5725 and #10348 to use SysV semaphores. #10348 was closed because "implementing SysV semaphores would be a step backwards, plus the API is a real pain" (wrote Charles-Fran├žois Natali).

Would it be possible to make concurrent.futures dependency optional? In Trollius project (port of asyncio on Python 2), I implemented a very simple synchronous executor used by default as a fallback when concurrent.futures is not available (Trollius uses futures, backport of concurrent.futures for Python 2).

Attached patch is the synchronous executor adapted again on asyncio.

asyncio.executor.Future (when concurrent.futures is missing) is the simplest class and has a different API than concurrent.futures.Future. It is directly created with known result (value or exeption).
msg211466 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-02-18 00:38
Oh, it looks like concurrent.futures and asyncio now works on OpenBSD 5.5:
(at least tests are running)

OpenBSD 5.5 added support of POSIX semaphores?
msg211472 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2014-02-18 03:12
I'd prefer not to add a bad hack to support such a broken platform. If it doesn't have semaphores, not much Python code will run.

Maybe the dummy_threading module can be used instead?
msg211481 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-02-18 08:17
> I'd prefer not to add a bad hack to support such a broken platform. If it doesn't have semaphores, not much Python code will run.

Oh, in fact concurrent.futures and multiprocessing are available on OpenBSD 5.5 (see the new buildbot created yesterday). test_asyncio is running on this buildbot.

So I suggest to upgrade to OpenBSD 5.5 (currently under development) if you would like to use asyncio.
Date User Action Args
2014-02-18 08:17:21vstinnersetstatus: open -> closed
resolution: wont fix
messages: + msg211481
2014-02-18 03:12:43gvanrossumsetmessages: + msg211472
2014-02-18 00:38:41vstinnersetmessages: + msg211466
2014-02-17 23:42:54vstinnercreate