Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8812335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:34:55+00:00 2026-06-14T03:34:55+00:00

There is a native c++ application (linux) that load mono assembly. How to to

  • 0

There is a native c++ application (linux) that load mono assembly.
How to to share mutex (or his analogue) between managed and native parts of same application?

something like this:

native part:

native_lock_mutex(&db_mutex);
// do something with db
native_unlock_mutex(&db_mutex);

mono part:

managed_lock_mutex(db_mutex);
// do something with db
managed_unlock_mutex(db_mutex);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:34:58+00:00Added an answer on June 14, 2026 at 3:34 am

    You must expose the native mutex to managed code, something like this:

    C code:

    pthread_mutex_t* managed_get_mutex ()
    {
        return &db_mutex;
    }
    
    void managed_lock_mutex (pthread_mutex_t *mutex)
    {
        pthread_mutex_lock (mutex):
    }
    
    void managed_unlock_mutex (pthread_mutex_t *mutex)
    {
        phtread_mutex_unlock (mutex);
    }
    

    C# code:

    class NativMutex {
        [DllImport ("nativeLibrary")]
        public static export IntPtr get_managed_mutex ();
    
        [DllImport ("nativeLibrary")]
        public static export void managed_lock_mutex (IntPtr mutex);
    
        [DllImport ("nativeLibrary")]
        public static export void managed_unlock_mutex (IntPtr mutex);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is native C++ application that hosts several .net components. When some error occurs
I understood that in order to use cookies inside of phonegap native app there
I have a native C++ application that works fine in the office (we do
I have a native application that uses a UIWebView and notice that with sites
I'm starting to write a small application for Linux under the Mono framework, the
I'm developing the native application that works with Android via the NDK. I need
I have a Linux C++ application that creates a JVM and makes JNI calls.
We have Win Forms application uses the 3rd party windows native controls. Can these
Is there any native compression (for javascript/css files) available in ASP.NET?
Is there a native JDK code to copy files(buffers, streams, or whatever)?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.