Re: Sharing the socket between 2 threads



igor.g wrote:
Hello,

I want to create asynchronous IMAP client.
My plan is to use 2 threads: main for writing and slave for background
reading. Is it possible ?
If so, how to share the socket between 2 threads ?
I can use transfer or detach / attach commands but I will lose control
at the socket in the main thread.

In Tcl you do not need threads for want you want to do -- read up on the event loop.

BTW, David Gravereaux answered the question you asked, as opposed to the one you should have asked (which I answered).


--
+------------------------------------------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
.



Relevant Pages

  • Re: Suggestions for reading binary data from a connected socket.
    ... >to find an example explaining the best solution for reading and writing a ... >message from a socket. ...
    (comp.lang.java.programmer)
  • Sharing the socket between 2 threads
    ... My plan is to use 2 threads: main for writing and slave for background ... reading. ... how to share the socket between 2 threads? ...
    (comp.lang.tcl)
  • Re: Multithread safety
    ... What I meant to say is: If one thread is writing to ... the socket while another one is reading to it (full-duplex), ...
    (microsoft.public.win32.programmer.networks)
  • Re: How do I know ECONNREFUSED from non-blocking connect?
    ... > before the socket is reported as writable. ... Before the socket reports ... > don't go reading or writing if you really want to know what the ... I am actually writing a higher-level library! ...
    (comp.unix.programmer)
  • Re: Multithread safety
    ... > the socket while another one is reading to it (full-duplex), ... > its impossible in certain cases for the writing thread to ...
    (microsoft.public.win32.programmer.networks)

Loading