This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Shared information between process


On Thu, Jul 08, 2004 at 09:05:20AM +0800, jackylam@solomon-systech.com wrote:
>I want to share "1" bit between two same cygwin processes.  I know I
>should use cygipc or cygserver formally.  But I really want to run the
>system in a simple and standalone way.  Is there any unused bit in
>cygwin internal structure I can use to share that bit?

If there was it would be a horrendously bad idea for you to use it.
Since it isn't documented, it would be subject to change and then where
would you be when you upgraded to a new version of cygwin?

>Or any other idea is welcome.  Thanks.

Check the "info gcc" documentation and look for the "shared" attribute.
It probably does exactly what you want.  I've extracted a section from
the documentation below.

cgf

`shared'
     On Microsoft Windows, in addition to putting variable definitions
     in a named section, the section can also be shared among all
     running copies of an executable or DLL.  For example, this small
     program defines shared data by putting it in a named section
     `shared' and marking the section shareable:

          int foo __attribute__((section ("shared"), shared)) = 0;
          
          int
          main()
          {
            /* Read and write foo.  All running
               copies see the same value.  */
            return 0;
          }

     You may only use the `shared' attribute along with `section'
     attribute with a fully initialized global definition because of
     the way linkers work.  See `section' attribute for more
     information.

     The `shared' attribute is only available on Microsoft Windows.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]