Socket and spawn()

Andy Valencia dont at spam.me
Fri May 31 22:51:58 UTC 2024


On Friday, 31 May 2024 at 19:48:37 UTC, kdevel wrote:
> Have you taken into consideration that each of the 
> (pre-spawned) threads
> can call accept()? Your program may also accept in multiple 
> processes on the same socket. [1]

Yes, but I am planning on some global behavior--mostly concerning 
resource consumption--where that would make implementing the 
policy harder.

I've indeed done the cast-to-shared and then cast-to-unshared and 
it's working fine.

BTW, if the strategy forward is where the type system is going to 
assist with flagging code paths requiring allowance for multiple 
threads, it would be nice if the modifiers were available 
symmetrically.  "shared" and "unshared", "mutable" and 
"immutable", and so forth?  I'm using:

     alias Unshared(T) = T;
     alias Unshared(T: shared U, U) = U;

and that's fine, but for core semantics of the language, it might 
make sense to treat these as first class citizens.

Andy



More information about the Digitalmars-d-learn mailing list