9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@speakeasy.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Thread Library
Date: Wed,  6 Feb 2002 12:19:14 -0500	[thread overview]
Message-ID: <20020206171914.AFECF3F40B@quanstro.net> (raw)

not to defend nt, but i had no problem calling select() from
the wsa library. i did create an include file that mapped the
errors from WSAx to Ey and hid all the include nasties (unix
is even worse than nt in this case). it looked like:

------

#if defined(NT)
#define boolean _fuck_windows_
#include <winsock.h>
#undef boolean

#ifndef EWOULDBLOCK
#define EWOULDBLOCK             WSAEWOULDBLOCK
#define EINPROGRESS             WSAEINPROGRESS
#define EALREADY                WSAEALREADY
#define ENOTSOCK                WSAENOTSOCK
#define EDESTADDRREQ            WSAEDESTADDRREQ
#define EMSGSIZE                WSAEMSGSIZE
#define EPROTOTYPE              WSAEPROTOTYPE
#define ENOPROTOOPT             WSAENOPROTOOPT
#define EPROTONOSUPPORT         WSAEPROTONOSUPPORT
#define ESOCKTNOSUPPORT         WSAESOCKTNOSUPPORT
#define EOPNOTSUPP              WSAEOPNOTSUPP
#define EPFNOSUPPORT            WSAEPFNOSUPPORT
#define EAFNOSUPPORT            WSAEAFNOSUPPORT
#define EADDRINUSE              WSAEADDRINUSE
#define EADDRNOTAVAIL           WSAEADDRNOTAVAIL
#define ENETDOWN                WSAENETDOWN
#define ENETUNREACH             WSAENETUNREACH
#define ENETRESET               WSAENETRESET
#define ECONNABORTED            WSAECONNABORTED
#define ECONNRESET              WSAECONNRESET
#define ENOBUFS                 WSAENOBUFS
#define EISCONN                 WSAEISCONN
#define ENOTCONN                WSAENOTCONN
#define ESHUTDOWN               WSAESHUTDOWN
#define ETOOMANYREFS            WSAETOOMANYREFS
#define ETIMEDOUT               WSAETIMEDOUT
#define ECONNREFUSED            WSAECONNREFUSED
#define ELOOP                   WSAELOOP
#define EHOSTDOWN               WSAEHOSTDOWN
#define EHOSTUNREACH            WSAEHOSTUNREACH
#define EPROCLIM                WSAEPROCLIM
#define EUSERS                  WSAEUSERS
#define EDQUOT                  WSAEDQUOT
#define ESTALE                  WSAESTALE
#define EREMOTE                 WSAEREMOTE
#endif

#else
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif

----------

Russ Cox wrote:
> To the best of my knowledge, you can't implement threadkill
> completely on NT since I don't see how to send an interrupt to
> another process.

I'm pretty sure you can't.  The best you can do is send it a message
to _persuade_ it to pack it in.  My theory is that the program loader,
oops kernel, forcibly kills processes by ripping them out of memory
and throwing away their kernel resources.

The whole model is totally and utterly flawed.

I guess you could have a thread manager thread that receives a
threadkill messages and kills 'em.  Such revolting hacks are often
the only way to do it.

Try writing rsh [remote shell] on NT.  You can't select [WaitForMultipleObjects
or whatever it's called] on sockets ...  It's doable, but revolting.



             reply	other threads:[~2002-02-06 17:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-06 17:19 erik quanstrom [this message]
2002-02-07 10:35 ` Boyd Roberts
  -- strict thread matches above, loose matches on Subject: below --
2002-02-07 13:45 Russ Cox
2002-02-05  7:38 [9fans] Thread library nigel
2002-02-05  2:31 Russ Cox
2002-02-05 11:31 ` Boyd Roberts
2002-02-05  2:25 Andrew Simmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020206171914.AFECF3F40B@quanstro.net \
    --to=quanstro@speakeasy.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).