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

  • Home
  • SEARCH
  • 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 8924917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:33:16+00:00 2026-06-15T07:33:16+00:00

This is my callback function and I set the rcv_buffer to be global def

  • 0

This is my callback function and I set the rcv_buffer to be global

def rx_callback(ok, payload):
    global n_rcvd, n_right, rcv_buffer
    n_rcvd += 1
    (pktno,) = struct.unpack('!H', payload[0:2])
    if ok:
        n_right += 1
        rcv_buffer.append((pktno, payload))

And in the main() I continuously check the buffer to see whether the buffer is empty:

   while 1:
        while len(rcv_buffer) > 0:
            (pktno, payload) = rcv_buffer.pop(0)
            print 'pktno = ', pktno, 'payload = ', payload[2:]

But I didn’t do any synchronizations! Can I be sure that my operations on the list will not crash?Thanks!

  • 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-15T07:33:17+00:00Added an answer on June 15, 2026 at 7:33 am

    In CPython, this is safe due to the interpreted nature of the execution, and due to the Global Interpeter Lock (which ensures that only a single bytecode from a single thread is executing at any given time).

    Other Python implementations might be quite so forgiving though…

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

Sidebar

Related Questions

I'm stuck on this asynchronous function problem. I need to set a global variable
I'm trying to set a callback function in Jack. This is usually quite simple,
I have this static callback function in MyClass, and I try to call another
I am trying to do the following: function main(callback) { $.ajax('server-side', function() { this.callback.call(hello);
I want to use this function EnumWindows(EnumWindowsProc, NULL);. The EnumWindowsProc is a Callback function:
I am currently doing something like this: myFunc(tracer); function tracer(message:String):void{ trace(message); } function myFunc(callback:Function):void{
In the code below: DbModels.prototype.updateById = function(_collection, id, field, value, callback) { this.getCollection(_collection, function(error,
This my jquery function, function getRecordspage(curPage, pagSize) { // code here $(.pager).pagination(strarr[1], { callback:
When I set-up fullCalendar and set eventRender function callback, I want to set the
Normally, I can use this , in the callback function: $this->form_validation->set_message(_custom, My custom message.);

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.