DiamondLightSource / DiamondLightSource/cothread

Exceptions raised in `Spawn`ed cothread can be lost

Open
#40 3 comments 0 reactions 0 assignees View on GitHub
cannot fix
Dominant language
C
Stars
13
Forks
11
PR merge metrics
No merged PRs in 30d

Description

The `Spawn` option `raise_on_wait` causes reporting of any exception terminating the spawned cothread to be deferred until `.Wait()` is called on the associated cothread, for instance:
```python
def task(): raise Exception('Die')
def test():
action = Spawn(task, raise_on_wait = True)
action.Wait()
```
Unfortunately if `.Wait()` is never called then the associated exception is never reported.

It _might_ be possible to fix this by added a `__del__` method to `Spawn` and reporting any exception that hasn't already been reported.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.