Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Poster wanted examples/docs for using insert/update cursors from a multithreaded ESQL/C program. Jonathan Leffler supplied the syntax: CONNECT TO :dbase AS :conn_name USER/USING ... WITH CONCURRENT TRANSACTIONS, plus SET CONNECTION and DISCONNECT, pointing to Informix's online answers, and noted only one connection can use shared memory. Art Kagel added that each thread needs its own connection (or a pooled one guarded by mutexes/conditions), since only one thread can use a connection at a time. The shared-memory limitation was raised as a wishlist item with no fix promised; the original poster also noted forked processes outperformed threads in his tests.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Does anyone have any simple example code (or where I can find some
documentation) for multithreading an insert and/or update cursor? I
can't seem to find a reference to it in my manual... I don't use it
that often and all I can remember is the phrase 'with concurrent
transaction' and something about disconnecting, but nothing specific.
--
# unrm /
ksh: unrm: not found
# man cpio
Sent via Deja.com http://www.deja.com/
Before you buy.
↪ replying to mars1972@my-deja.com
Jonathan Leffler — — source: Informix-list mailing list archive (1991-1998)
mars1972@my-deja.com wrote:
> Does anyone have any simple example code (or where I can find some
> documentation) for multithreading an insert and/or update cursor? I
> can't seem to find a reference to it in my manual... I don't use it
> that often and all I can remember is the phrase 'with concurrent
> transaction' and something about disconnecting, but nothing specific.
EXEC SQL CONNECT TO :dbase AS :conn_name USER :username USING :password
WITH CONCURRENT TRANSACTIONS;
EXEC SQL SET CONNECTION :conn_name;
EXEC SQL DISCONNECT :conn_name;
Also: http://www.informix.com/answers
Note that only one connection can use shared memory.
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
"I don't suffer from insanity; I enjoy every minute of it!"
↪ replying to Jonathan Leffler
smooth1 — — source: Informix-list mailing list archive (1991-1998)
Jonathan Leffler wrote in message
>Note that only one connection can use shared memory.
>
Why? This seems a silly limitation! Any chance of getting it
fixed??
>--
>Yours,
>Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
>Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
> "I don't suffer from insanity; I enjoy every minute of it!"
In article <3a089bbd_1@news1.vip.uk.com>,
"smooth1" <smooth1@iclway.co.uk> wrote:
>
> Jonathan Leffler wrote in message
> >Note that only one connection can use shared memory.
> >
>
> Why? This seems a silly limitation! Any chance of getting it
> fixed??
>
I agree. I sent a suggestion to Informix's suggestion box. Actually,
it turned out to be Jonathan that replied to it. I'll let him fill you
in on the details, but essentially, it'll be a tough job, and won't be
done within the next 6 months. (Correct me if I'm wrong here,
Jonathan.) After I originally posted this message, I remembered that
about 2 years ago I did some testing with single threading vs
multithreading vs forked processes. Guess which one won? forked
processes, by far. Unfortunately, it's more difficult to get them to
communicate, they can't share a cursor, and it's kinda ugly.
I suggest that you (any anyone else that's interested) send a similar
suggesting to informix. The more people who suggest this, the more
likely (I would think) that it would get done. Of course, this all
depends on how busy the developers are. There may be more pressing
problems that they need to be working on.
> >--
> >Yours,
> >Jonathan Leffler (Jonathan.Leffler@Informix.com) #include
<disclaimer.h>
> >Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
> > "I don't suffer from insanity; I enjoy every minute of it!"
>
>
--
# unrm /
ksh: unrm: not found
# man cpio
Sent via Deja.com http://www.deja.com/
Before you buy.
↪ replying to mars1972@my-deja.com
Art S. Kagel — — source: Informix-list mailing list archive (1991-1998)
In addition to Jonathan's comments, note that only one thread can access
a connection at a time. Each thread either has to have it's own connection
or it must relinquish the connection (or one of a pool of connections) so
that another thread can use it. You must control this access with mutexes
or conditions or both.
Art S. Kagel
mars1972@my-deja.com wrote:
>
> Does anyone have any simple example code (or where I can find some
> documentation) for multithreading an insert and/or update cursor? I
> can't seem to find a reference to it in my manual... I don't use it
> that often and all I can remember is the phrase 'with concurrent
> transaction' and something about disconnecting, but nothing specific.
>
> --
> # unrm /
> ksh: unrm: not found
> # man cpio
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.