Why not make a task to construct X? Then the caller must call ".get" in order to get the X, which makes the fact that it blocks explicit. The task will run in the background, so the caller can do whatever it likes in the foreground until it decides to block on the X finishing up. At that point, you'll have guaranteed that X is done blocking, so none of its methods need to be synch-blockers anymore.
↧