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 8992855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:03:20+00:00 2026-06-15T23:03:20+00:00

function A(int a[]) { SemLock() //Some Code…. SemUnlock() } Suppose some other thread has

  • 0
function A(int a[])
{
SemLock()

  //Some Code....

SemUnlock()

}

Suppose some other thread has taken the same lock. Hence this function is blocked. Suppose this function is called by many other threads. All will be blocked. After Unlocking, will the data (parameter a[]) be lost or retained passed in as the parameter by different threads. How does this queuing of data takes place?

  • 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-15T23:03:22+00:00Added an answer on June 15, 2026 at 11:03 pm

    parameter a[] is thread specific (non-shareable) so each thread has their own copy of a[]. When a thread created a data-structure for thread is created. a[] is stored in thread’s stack.

    There is a queue of thread associated with each semaphore variable.

    typedef struct {
    int count;
    queue q; /* queue of threads waiting on this semaphore */
    } Semaphore; 
    

    [ANSWER]
    a[] will not loss.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's suppose I have a function: int f1(int x){ // some more or less
When compiling this code I get the following error : In function 'int main()':
I'm running some commands with the C++ system() function: int system ( const char
I am inside a function with some arguments. Let's say: __cdecl function(int a,int b,long
I have the following function int namecomp(char c); Part of the function code else
Errors while calling int getopt function from http://code.google.com/p/darungrim/source/browse/trunk/ExtLib/XGetopt.cpp?r=17 `check.cpp: In function ‘int main()’:` check.cpp:14:55:
Suppose that I have the following c function: int MyFunction( const float arr[] )
I have some objects on the stack in main function: int main(...) { CFoo
We have an existing function implementation in our C++ code: void Function(int param) {
I know for sure that function(int *a); function(int a[]); in C are the same,

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.