comp.lang.ada
 help / color / mirror / Atom feed
* Sockets in Apex
@ 2000-02-09  0:00 reason67
  2000-02-09  0:00 ` Ted Dennison
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: reason67 @ 2000-02-09  0:00 UTC (permalink / raw)


I wrote a socket binding to Ada 95. I am creating an executable in Apex
3.2.0b on Solaris 2.6.

When I connect a non-blocking client socket in a task in the threaded
model, errno does not seem to be set by the underlying C. When I run in
the non-threaded model, or I connect the client without any tasks (just
the main), or I make the socket block, everything works fine.

I am a little stumped why this is happening. If there is any Apex
Threaded runtime guru's out there who know why this occurs I would be
very interested.
---
Jeffrey Blatt


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sockets in Apex
  2000-02-09  0:00 Sockets in Apex reason67
  2000-02-09  0:00 ` Ted Dennison
@ 2000-02-09  0:00 ` Jim Rogers
  2000-02-12  0:00 ` Simon Wright
  2 siblings, 0 replies; 4+ messages in thread
From: Jim Rogers @ 2000-02-09  0:00 UTC (permalink / raw)


In article <87s92v$lke$1@nnrp1.deja.com>,
  reason67@my-deja.com wrote:
> I wrote a socket binding to Ada 95. I am creating an executable in
Apex
> 3.2.0b on Solaris 2.6.
>
> When I connect a non-blocking client socket in a task in the threaded
> model, errno does not seem to be set by the underlying C. When I run
in
> the non-threaded model, or I connect the client without any tasks
(just
> the main), or I make the socket block, everything works fine.
>

I believe this is because the non-blocking form of the C socket
library is not thread-safe. Specifically, the errno result is not
available to a thread, but only to a process. This would be
consistent with your results.

If this is the case, there is nothing Ada can fix. The problem is in
the C library call you bind to.

--
Jim Rogers
Colorado Springs, Colorado USA


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sockets in Apex
  2000-02-09  0:00 Sockets in Apex reason67
@ 2000-02-09  0:00 ` Ted Dennison
  2000-02-09  0:00 ` Jim Rogers
  2000-02-12  0:00 ` Simon Wright
  2 siblings, 0 replies; 4+ messages in thread
From: Ted Dennison @ 2000-02-09  0:00 UTC (permalink / raw)


In article <87s92v$lke$1@nnrp1.deja.com>,
  reason67@my-deja.com wrote:

> When I connect a non-blocking client socket in a task in the threaded
> model, errno does not seem to be set by the underlying C. When I run
> in the non-threaded model, or I connect the client without any tasks
> (just the main), or I make the socket block, everything works fine.

I don't have access to your system docs, but I'd bet the answer's in
there. Typically threaded C libraries update a per-thread version of
errno, rather than the global errno. The reason for doing it this way
should be obvious.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sockets in Apex
  2000-02-09  0:00 Sockets in Apex reason67
  2000-02-09  0:00 ` Ted Dennison
  2000-02-09  0:00 ` Jim Rogers
@ 2000-02-12  0:00 ` Simon Wright
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Wright @ 2000-02-12  0:00 UTC (permalink / raw)


reason67@my-deja.com writes:

> I wrote a socket binding to Ada 95. I am creating an executable in Apex
> 3.2.0b on Solaris 2.6.
> 
> When I connect a non-blocking client socket in a task in the threaded
> model, errno does not seem to be set by the underlying C. When I run in
> the non-threaded model, or I connect the client without any tasks (just
> the main), or I make the socket block, everything works fine.

I take it the "underlying C" is yours? have you compiled it with
-D_REENTRANT ? (I _think_ that's the Solaris way of saying the
compiler should pick up the thread-aware version of errno and others).

From the Linux <errno.h>,

  #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
  extern int*	__errno_location  __P((void));
  #define errno	(*__errno_location ())
  #else
  extern int errno;
  #endif




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-02-12  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-09  0:00 Sockets in Apex reason67
2000-02-09  0:00 ` Ted Dennison
2000-02-09  0:00 ` Jim Rogers
2000-02-12  0:00 ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox